Bylaw

Gallery › App Configuration › Azure built-in policies

App Configuration should use a customer-managed key

Converted Policy Audit Deny Disabled Mode Indexed Version 1.1.0

Customer-managed keys provide enhanced data protection by allowing you to manage your encryption keys. This is often required to meet compliance requirements.

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

Azure Policy JSONCustomerManagedKey_Audit.json · 50 lines
{
  "properties": {
    "displayName": "App Configuration should use a customer-managed key",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Customer-managed keys provide enhanced data protection by allowing you to manage your encryption keys. This is often required to meet compliance requirements.",
    "metadata": {
      "version": "1.1.0",
      "category": "App Configuration"
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "String",
        "defaultValue": "Audit",
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.AppConfiguration/configurationStores"
          },
          {
            "field": "Microsoft.AppConfiguration/configurationStores/encryption.keyVaultProperties.keyIdentifier",
            "exists": "false"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.1.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/967a4b4b-2da9-43c1-b7d0-f98d0d74d0b1",
  "name": "967a4b4b-2da9-43c1-b7d0-f98d0d74d0b1"
}
Bylaw967a4b4b-2da9-43c1-b7d0-f98d0d74d0b1.bylaw.ps1 · 28 lines
# Converted from CustomerManagedKey_Audit.json by ConvertTo-Bylaw.
Policy '967a4b4b-2da9-43c1-b7d0-f98d0d74d0b1' {

    Properties @{
        DisplayName   = 'App Configuration should use a customer-managed key'
        Description   = 'Customer-managed keys provide enhanced data protection by allowing you to manage your encryption keys. This is often required to meet compliance requirements.'
        Version       = '1.1.0'
        Category      = 'App Configuration'
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.AppConfiguration/configurationStores' {

        Require 'encryption.keyVaultProperties.keyIdentifier exists' {
            Field encryption.keyVaultProperties.keyIdentifier | Must -Exist
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/App Configuration/CustomerManagedKey_Audit.json in Azure/azure-policy, under the MIT licence.