Gallery › Sovereignty › Azure built-in policies
[Preview]: Container Apps environments should use customer-managed keys to encrypt data at rest
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0-preview Preview
Use customer-managed keys to manage encryption at rest for Container Apps environments. Customer-managed keys enable data to be encrypted with an Azure Key Vault key created and owned by you, giving you control over the key lifecycle, including rotation and management.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONEnvironmentCMK_Audit.json · 59 lines
{
"properties": {
"displayName": "[Preview]: Container Apps environments should use customer-managed keys to encrypt data at rest",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Use customer-managed keys to manage encryption at rest for Container Apps environments. Customer-managed keys enable data to be encrypted with an Azure Key Vault key created and owned by you, giving you control over the key lifecycle, including rotation and management.",
"metadata": {
"version": "1.0.0-preview",
"preview": true,
"category": "Sovereignty"
},
"version": "1.0.0-preview",
"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.App/managedEnvironments"
},
{
"anyOf": [
{
"field": "Microsoft.App/managedEnvironments/diskEncryptionConfiguration.keyVaultConfiguration.keyUrl",
"exists": false
},
{
"field": "Microsoft.App/managedEnvironments/diskEncryptionConfiguration.keyVaultConfiguration.keyUrl",
"equals": ""
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/0253f0dc-b6de-4795-97ae-1ee0b4ffe3a6",
"name": "0253f0dc-b6de-4795-97ae-1ee0b4ffe3a6"
}Bylaw0253f0dc-b6de-4795-97ae-1ee0b4ffe3a6.bylaw.ps1 · 33 lines
# Converted from EnvironmentCMK_Audit.json by ConvertTo-Bylaw.
Policy '0253f0dc-b6de-4795-97ae-1ee0b4ffe3a6' {
Properties @{
DisplayName = '[Preview]: Container Apps environments should use customer-managed keys to encrypt data at rest'
Description = 'Use customer-managed keys to manage encryption at rest for Container Apps environments. Customer-managed keys enable data to be encrypted with an Azure Key Vault key created and owned by you, giving you control over the key lifecycle, including rotation and management.'
Version = '1.0.0-preview'
Preview = $true
Category = 'Sovereignty'
PolicyVersion = '1.0.0-preview'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.App/managedEnvironments' {
Require 'diskEncryptionConfiguration.keyVaultConfiguration.keyUrl exists' {
Field diskEncryptionConfiguration.keyVaultConfiguration.keyUrl | Must -Exist
}
Require 'diskEncryptionConfiguration.keyVaultConfiguration.keyUrl is not' {
Field diskEncryptionConfiguration.keyVaultConfiguration.keyUrl | Must -Not -Be '' -IfPresent
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Sovereignty/EnvironmentCMK_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw