Gallery › Kubernetes › Azure built-in policies
Azure Kubernetes Clusters should enable Key Management Service (KMS)
Converted Policy Audit Disabled Mode Indexed Version 1.1.0
Use Key Management Service (KMS) to encrypt secret data at rest in etcd for Kubernetes cluster security. Learn more at: https://aka.ms/aks/kmsetcdencryption.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAKS_EnableKMS.json · 51 lines
{
"properties": {
"displayName": "Azure Kubernetes Clusters should enable Key Management Service (KMS)",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Use Key Management Service (KMS) to encrypt secret data at rest in etcd for Kubernetes cluster security. Learn more at: https://aka.ms/aks/kmsetcdencryption.",
"metadata": {
"version": "1.1.0",
"category": "Kubernetes"
},
"version": "1.1.0",
"parameters": {
"effect": {
"type": "String",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy",
"portalReview": true
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.ContainerService/managedClusters"
},
{
"field": "Microsoft.ContainerService/managedClusters/securityProfile.azureKeyVaultKms.enabled",
"notEquals": true
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.1.0",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/dbbdc317-9734-4dd8-9074-993b29c69008",
"name": "dbbdc317-9734-4dd8-9074-993b29c69008"
}Bylawdbbdc317-9734-4dd8-9074-993b29c69008.bylaw.ps1 · 29 lines
# Converted from AKS_EnableKMS.json by ConvertTo-Bylaw.
Policy 'dbbdc317-9734-4dd8-9074-993b29c69008' {
Properties @{
DisplayName = 'Azure Kubernetes Clusters should enable Key Management Service (KMS)'
Description = 'Use Key Management Service (KMS) to encrypt secret data at rest in etcd for Kubernetes cluster security. Learn more at: https://aka.ms/aks/kmsetcdencryption.'
Version = '1.1.0'
Category = 'Kubernetes'
PolicyVersion = '1.1.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
Metadata = [ordered]@{ portalReview = $true }
}
Resource 'Microsoft.ContainerService/managedClusters' {
Require 'securityProfile.azureKeyVaultKms.enabled is true' {
Field securityProfile.azureKeyVaultKms.enabled | Must -Be $true
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Kubernetes/AKS_EnableKMS.json in Azure/azure-policy, under the MIT licence.
Bylaw