Gallery › Kubernetes › Azure built-in policies
Both operating systems and data disks in Azure Kubernetes Service clusters should be encrypted by customer-managed keys
Converted Policy Audit Disabled Mode Indexed Version 2.0.0
Encrypting OS and data disks using customer-managed keys provides more control and greater flexibility in key management. This is a common requirement in many regulatory and industry compliance standards.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAKS_CMK_Deny.json · 59 lines
{
"properties": {
"policyType": "BuiltIn",
"displayName": "Both operating systems and data disks in Azure Kubernetes Service clusters should be encrypted by customer-managed keys",
"description": "Encrypting OS and data disks using customer-managed keys provides more control and greater flexibility in key management. This is a common requirement in many regulatory and industry compliance standards.",
"metadata": {
"version": "2.0.0",
"category": "Kubernetes"
},
"version": "2.0.0",
"mode": "Indexed",
"parameters": {
"effect": {
"type": "String",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "'Audit' allows a non-compliant resource to be created or updated, but flags it as non-compliant. 'Deny' is not supported from 2.0.0. 'Disabled' turns off the policy.",
"portalReview": true
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.ContainerService/managedClusters"
},
{
"anyOf": [
{
"field": "Microsoft.ContainerService/managedClusters/diskEncryptionSetID",
"exists": "False"
},
{
"field": "Microsoft.ContainerService/managedClusters/diskEncryptionSetID",
"equals": ""
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"2.0.0",
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/7d7be79c-23ba-4033-84dd-45e2a5ccdd67",
"name": "7d7be79c-23ba-4033-84dd-45e2a5ccdd67"
}Bylaw7d7be79c-23ba-4033-84dd-45e2a5ccdd67.bylaw.ps1 · 33 lines
# Converted from AKS_CMK_Deny.json by ConvertTo-Bylaw.
Policy '7d7be79c-23ba-4033-84dd-45e2a5ccdd67' {
Properties @{
DisplayName = 'Both operating systems and data disks in Azure Kubernetes Service clusters should be encrypted by customer-managed keys'
Description = 'Encrypting OS and data disks using customer-managed keys provides more control and greater flexibility in key management. This is a common requirement in many regulatory and industry compliance standards.'
Version = '2.0.0'
Category = 'Kubernetes'
PolicyVersion = '2.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = '''Audit'' allows a non-compliant resource to be created or updated, but flags it as non-compliant. ''Deny'' is not supported from 2.0.0. ''Disabled'' turns off the policy.'
Metadata = [ordered]@{ portalReview = $true }
}
Resource 'Microsoft.ContainerService/managedClusters' {
Require 'diskEncryptionSetID exists' {
Field diskEncryptionSetID | Must -Exist
}
Require 'diskEncryptionSetID is not' {
Field diskEncryptionSetID | Must -Not -Be '' -IfPresent
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Kubernetes/AKS_CMK_Deny.json in Azure/azure-policy, under the MIT licence.
Bylaw