Bylaw

Gallery › Data Box › Azure built-in policies

Azure Data Box jobs should enable double encryption for data at rest on the device

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Enable a second layer of software-based encryption for data at rest on the device. The device is already protected via Advanced Encryption Standard 256-bit encryption for data at rest. This option adds a second layer of data encryption.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONDoubleEncryption_Audit.json · 70 lines
{
  "properties": {
    "displayName": "Azure Data Box jobs should enable double encryption for data at rest on the device",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Enable a second layer of software-based encryption for data at rest on the device. The device is already protected via Advanced Encryption Standard 256-bit encryption for data at rest. This option adds a second layer of data encryption.",
    "metadata": {
      "version": "1.0.0",
      "category": "Data Box"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "The desired effect of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      },
      "supportedSKUs": {
        "type": "Array",
        "metadata": {
          "displayName": "Supported SKUs",
          "description": "The list of SKUs that support software-based double encryption"
        },
        "allowedValues": [
          "DataBox",
          "DataBoxHeavy"
        ],
        "defaultValue": [
          "DataBox",
          "DataBoxHeavy"
        ]
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.DataBox/jobs"
          },
          {
            "field": "Microsoft.Databox/jobs/sku.name",
            "in": "[parameters('supportedSKUs')]"
          },
          {
            "field": "Microsoft.DataBox/jobs/details.preferences.encryptionPreferences.doubleEncryption",
            "notEquals": "Enabled"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/c349d81b-9985-44ae-a8da-ff98d108ede8",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "c349d81b-9985-44ae-a8da-ff98d108ede8"
}
Bylawc349d81b-9985-44ae-a8da-ff98d108ede8.bylaw.ps1 · 39 lines
# Converted from DoubleEncryption_Audit.json by ConvertTo-Bylaw.
Policy 'c349d81b-9985-44ae-a8da-ff98d108ede8' {

    Properties @{
        DisplayName   = 'Azure Data Box jobs should enable double encryption for data at rest on the device'
        Description   = 'Enable a second layer of software-based encryption for data at rest on the device. The device is already protected via Advanced Encryption Standard 256-bit encryption for data at rest. This option adds a second layer of data encryption.'
        Version       = '1.0.0'
        Category      = 'Data Box'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'The desired effect of the policy'
    }
    Parameter SupportedSKUs @{
        Type          = 'Array'
        AllowedValues = @('DataBox', 'DataBoxHeavy')
        Default       = @('DataBox', 'DataBoxHeavy')
        DisplayName   = 'Supported SKUs'
        Description   = 'The list of SKUs that support software-based double encryption'
    }

    Resource 'Microsoft.DataBox/jobs' {

        When {
            Field sku.name | Must -BeIn (Param SupportedSKUs)
        }

        Require 'details.preferences.encryptionPreferences.doubleEncryption is Enabled' {
            Field details.preferences.encryptionPreferences.doubleEncryption | Must -Be 'Enabled'
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Data Box/DoubleEncryption_Audit.json in Azure/azure-policy, under the MIT licence.