Gallery › Kubernetes › Azure built-in policies
Temp disks and cache for agent node pools in Azure Kubernetes Service clusters should be encrypted at host
Converted Policy Audit Disabled Mode Indexed Version 2.1.0
To enhance data security, the data stored on the virtual machine (VM) host of your Azure Kubernetes Service nodes VMs should be encrypted at rest. 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_EncryptionAtHost_Deny.json · 83 lines
{
"properties": {
"policyType": "BuiltIn",
"displayName": "Temp disks and cache for agent node pools in Azure Kubernetes Service clusters should be encrypted at host",
"description": "To enhance data security, the data stored on the virtual machine (VM) host of your Azure Kubernetes Service nodes VMs should be encrypted at rest. This is a common requirement in many regulatory and industry compliance standards.",
"metadata": {
"version": "2.1.0",
"category": "Kubernetes"
},
"version": "2.1.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"
},
{
"count": {
"field": "Microsoft.ContainerService/managedClusters/agentPoolProfiles[*]",
"where": {
"allOf": [
{
"value": "[coalesce(tryGet(current('Microsoft.ContainerService/managedClusters/agentPoolProfiles[*]'), 'mode'), '')]",
"notEquals": "Machines"
},
{
"value": "[coalesce(tryGet(current('Microsoft.ContainerService/managedClusters/agentPoolProfiles[*]'), 'type'), '')]",
"notEquals": "FlexNodes"
},
{
"anyOf": [
{
"field": "Microsoft.ContainerService/managedClusters/agentPoolProfiles[*].enableEncryptionAtHost",
"exists": "False"
},
{
"field": "Microsoft.ContainerService/managedClusters/agentPoolProfiles[*].enableEncryptionAtHost",
"equals": ""
},
{
"field": "Microsoft.ContainerService/managedClusters/agentPoolProfiles[*].enableEncryptionAtHost",
"equals": "false"
}
]
}
]
}
},
"greater": 0
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"2.1.0",
"2.0.0",
"1.1.0",
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/41425d9f-d1a5-499a-9932-f8ed8453932c",
"name": "41425d9f-d1a5-499a-9932-f8ed8453932c"
}Bylaw41425d9f-d1a5-499a-9932-f8ed8453932c.bylaw.ps1 · 37 lines
# Converted from AKS_EncryptionAtHost_Deny.json by ConvertTo-Bylaw.
Policy '41425d9f-d1a5-499a-9932-f8ed8453932c' {
Properties @{
DisplayName = 'Temp disks and cache for agent node pools in Azure Kubernetes Service clusters should be encrypted at host'
Description = 'To enhance data security, the data stored on the virtual machine (VM) host of your Azure Kubernetes Service nodes VMs should be encrypted at rest. This is a common requirement in many regulatory and industry compliance standards.'
Version = '2.1.0'
Category = 'Kubernetes'
PolicyVersion = '2.1.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 'agentPoolProfiles and enableEncryptionAtHost are as required' {
Count 'agentPoolProfiles[*]' -Where {
Arm '[coalesce(tryGet(current(''Microsoft.ContainerService/managedClusters/agentPoolProfiles[*]''), ''mode''), '''')]' | Must -Not -Be 'Machines'
Arm '[coalesce(tryGet(current(''Microsoft.ContainerService/managedClusters/agentPoolProfiles[*]''), ''type''), '''')]' | Must -Not -Be 'FlexNodes'
AnyOf {
Field enableEncryptionAtHost | Must -Not -Exist
Field enableEncryptionAtHost | Must -Be ''
Field enableEncryptionAtHost | Must -Be 'false'
}
} | Must -Be 0
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Kubernetes/AKS_EncryptionAtHost_Deny.json in Azure/azure-policy, under the MIT licence.
Bylaw