Bylaw

Gallery › ElasticSan › Azure built-in policies

ElasticSan Volume Group should use customer-managed keys to encrypt data at rest

Converted Policy Audit Disabled Mode All Version 1.0.0

Use customer-managed keys to manage the encryption at rest of your VolumeGroup. By default, customer data is encrypted with platform-managed keys, but CMKs 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, with full control and responsibility, including rotation and management.

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

Azure Policy JSONVolumeGroup_Encryption_Audit.json · 49 lines
{
  "properties": {
    "displayName": "ElasticSan Volume Group should use customer-managed keys to encrypt data at rest",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "Use customer-managed keys to manage the encryption at rest of your VolumeGroup. By default, customer data is encrypted with platform-managed keys, but CMKs 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, with full control and responsibility, including rotation and management.",
    "metadata": {
      "version": "1.0.0",
      "category": "ElasticSan"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.ElasticSan/elasticSans/volumeGroups"
          },
          {
            "field": "Microsoft.ElasticSan/elasticSans/volumeGroups/encryption",
            "notEquals": "EncryptionAtRestWithCustomerManagedKey"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/7698f4ed-80ce-4e13-b408-ee135fa400a5",
  "name": "7698f4ed-80ce-4e13-b408-ee135fa400a5"
}
Bylaw7698f4ed-80ce-4e13-b408-ee135fa400a5.bylaw.ps1 · 28 lines
# Converted from VolumeGroup_Encryption_Audit.json by ConvertTo-Bylaw.
Policy '7698f4ed-80ce-4e13-b408-ee135fa400a5' {

    Properties @{
        DisplayName   = 'ElasticSan Volume Group should use customer-managed keys to encrypt data at rest'
        Description   = 'Use customer-managed keys to manage the encryption at rest of your VolumeGroup. By default, customer data is encrypted with platform-managed keys, but CMKs 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, with full control and responsibility, including rotation and management.'
        Version       = '1.0.0'
        Category      = 'ElasticSan'
        PolicyVersion = '1.0.0'
        Mode          = 'All'
    }

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

    Resource 'Microsoft.ElasticSan/elasticSans/volumeGroups' {

        Require 'encryption is EncryptionAtRestWithCustomerManagedKey' {
            Field encryption | Must -Be 'EncryptionAtRestWithCustomerManagedKey'
        }
    }

    Effect (Param Effect)
}

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