OS and data disks should be encrypted with a customer-managed key
Facts read 10 Nov 2026. Page reviewed 16 Nov 2026.
OS and data disks should be encrypted with a customer-managed key is an Azure guardrail written in Azure Policy. Denies managed disks that are not encrypted with a customer-managed key. What it breaks: you take on key lifecycle work: the definition says you have full control and responsibility for the key lifecycle, including rotation and management.
More encryption and keys guardrails ยท About Azure Policy
Built-in policy definition: OS and data disks should be encrypted with a customer-managed key
Definition ID: 702dd420-7fcc-42c5-afe8-4026edd20fe0
Category: Compute
Supported effects: Audit, Deny, Disabled
policyRule (copied from the repository file):
{
"if": {
"anyOf": [
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines"
},
{
"field": "Microsoft.Compute/virtualMachines/storageProfile.osDisk.managedDisk.diskEncryptionSet.id",
"exists": "False"
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines"
},
{
"value": "[length(field('Microsoft.Compute/virtualMachines/storageProfile.dataDisks'))]",
"greater": 0
},
{
"field": "Microsoft.Compute/virtualMachines/storageProfile.dataDisks[*].managedDisk.id",
"exists": "False"
},
{
"field": "Microsoft.Compute/virtualMachines/storageProfile.dataDisks[*].managedDisk.diskEncryptionSet.id",
"exists": "False"
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachineScaleSets"
},
{
"field": "Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.storageProfile.osDisk.managedDisk.diskEncryptionSet.id",
"exists": "False"
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachineScaleSets"
},
{
"count": {
"field": "Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.storageProfile.dataDisks[*]"
},
"greater": 0
},
{
"not": {
"field": "Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.storageProfile.dataDisks[*].managedDisk.diskEncryptionSet.id",
"exists": "true"
}
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/disks"
},
{
"field": "Microsoft.Compute/disks/encryption.diskEncryptionSetId",
"exists": "False"
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/galleries/images/versions"
},
{
"value": "[length(field('Microsoft.Compute/galleries/images/versions/publishingProfile.targetRegions[*].encryption.osDiskImage.diskEncryptionSetId'))]",
"notEquals": "[length(field('Microsoft.Compute/galleries/images/versions/publishingProfile.targetRegions[*]'))]"
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/galleries/images/versions"
},
{
"value": "[length(field('Microsoft.Compute/galleries/images/versions/storageProfile.dataDiskImages[*]'))]",
"greater": 0
},
{
"anyOf": [
{
"count": {
"field": "Microsoft.Compute/galleries/images/versions/publishingProfile.targetRegions[*]",
"where": {
"value": "[length(current('Microsoft.Compute/galleries/images/versions/publishingProfile.targetRegions[*].encryption.dataDiskImages[*].diskEncryptionSetId'))]",
"notEquals": "[length(field('Microsoft.Compute/galleries/images/versions/storageProfile.dataDiskImages[*]'))]"
}
},
"greater": 0
},
{
"not": {
"field": "Microsoft.Compute/galleries/images/versions/publishingProfile.targetRegions[*].encryption.dataDiskImages[*].diskEncryptionSetId",
"exists": "true"
}
}
]
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/images"
},
{
"field": "Microsoft.Compute/images/storageProfile.osDisk.diskEncryptionSet.id",
"exists": "False"
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/images"
},
{
"value": "[length(field('Microsoft.Compute/images/storageProfile.dataDisks[*]'))]",
"greater": 0
},
{
"not": {
"field": "Microsoft.Compute/images/storageProfile.dataDisks[*].diskEncryptionSet.id",
"exists": "true"
}
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
- Blocks
- Denies managed disks that are not encrypted with a customer-managed key.
- Breaks
- You take on key lifecycle work: the definition says you have full control and responsibility for the key lifecycle, including rotation and management. (source)
- Test before applying
- As for every Azure Policy guardrail: how to test before enforcing
- Mechanism
- Azure Policy (built-in definitions): Resources at the scope of the assignment (management group, subscription, resource group) and their children, except notScopes and exemptions
- Taken from
- open source set, MIT License, Azure/azure-policy repository, https://raw.githubusercontent.com/Azure/azure-policy/master/LICENSE
What the source says
"Use customer-managed keys to manage the encryption at rest of the contents of your managed disks." (read 10 Nov 2026).
On what it breaks: "You have full control and responsibility for the key lifecycle, including rotation and management."
Related guardrails
- Deny KMS key deletionAWS, Service control policies (SCPs), encryption and keys
- Enforce a 30-day KMS key deletion windowAWS, Service control policies (SCPs), encryption and keys
- Deny disabling default EBS encryptionAWS, Service control policies (SCPs), encryption and keys
- Storage accounts should have the specified minimum TLS versionAzure, Azure Policy (built-in definitions), encryption and keys
- Key vaults should have deletion protection enabledAzure, Azure Policy (built-in definitions), encryption and keys
Related pages
Sources
- OS and data disks should be encrypted with a customer-managed key, read 10 Nov 2026
- How to test it first, read 10 Nov 2026
Last reviewed 16 Nov 2026.