Bylaw

Gallery › HDInsight › Azure built-in policies

Azure HDInsight clusters should use customer-managed keys to encrypt data at rest

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.1

Use customer-managed keys to manage the encryption at rest of your Azure HDInsight clusters. By default, customer data is encrypted with service-managed keys, but customer-managed keys are commonly required to meet regulatory compliance standards. Customer-managed keys enable the data to be encrypted with an Azure Key Vault key created and owned by you. You have full control and responsibility for the key lifecycle, including rotation and management. Learn more at https://aka.ms/hdi.cmk.

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

Azure Policy JSONCMK_Audit.json · 50 lines
{
  "properties": {
    "displayName": "Azure HDInsight clusters should use customer-managed keys to encrypt data at rest",
    "description": "Use customer-managed keys to manage the encryption at rest of your Azure HDInsight clusters. By default, customer data is encrypted with service-managed keys, but customer-managed keys are commonly required to meet regulatory compliance standards. Customer-managed keys enable the data to be encrypted with an Azure Key Vault key created and owned by you. You have full control and responsibility for the key lifecycle, including rotation and management. Learn more at https://aka.ms/hdi.cmk.",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "metadata": {
      "version": "1.0.1",
      "category": "HDInsight"
    },
    "version": "1.0.1",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.HDInsight/clusters"
          },
          {
            "field": "Microsoft.HDInsight/clusters/diskEncryptionProperties.keyName",
            "exists": false
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.1"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/64d314f6-6062-4780-a861-c23e8951bee5",
  "name": "64d314f6-6062-4780-a861-c23e8951bee5"
}
Bylaw64d314f6-6062-4780-a861-c23e8951bee5.bylaw.ps1 · 28 lines
# Converted from CMK_Audit.json by ConvertTo-Bylaw.
Policy '64d314f6-6062-4780-a861-c23e8951bee5' {

    Properties @{
        DisplayName   = 'Azure HDInsight clusters should use customer-managed keys to encrypt data at rest'
        Description   = 'Use customer-managed keys to manage the encryption at rest of your Azure HDInsight clusters. By default, customer data is encrypted with service-managed keys, but customer-managed keys are commonly required to meet regulatory compliance standards. Customer-managed keys enable the data to be encrypted with an Azure Key Vault key created and owned by you. You have full control and responsibility for the key lifecycle, including rotation and management. Learn more at https://aka.ms/hdi.cmk.'
        Version       = '1.0.1'
        Category      = 'HDInsight'
        PolicyVersion = '1.0.1'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.HDInsight/clusters' {

        Require 'diskEncryptionProperties.keyName exists' {
            Field diskEncryptionProperties.keyName | Must -Exist
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/HDInsight/CMK_Audit.json in Azure/azure-policy, under the MIT licence.