Gallery › Compute › Azure Community Policy
Audit OS and data disks encrypted without a customer-managed key
Converted Policy Audit Disabled Mode All Version 1.0.0
Audit if the OS or data disk is encrypted without a customer-managed key.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 44 lines
{
"name": "8fd16e35-18a1-4fc0-8d1a-e43cc95ec990",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Audit OS and data disks encrypted without a customer-managed key",
"description": "Audit if the OS or data disk is encrypted without a customer-managed key.",
"metadata": {
"category": "Compute",
"version": "1.0.0"
},
"mode": "All",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/disks"
},
{
"field": "Microsoft.Compute/disks/encryption.type",
"notEquals": "EncryptionAtRestWithCustomerKey"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw8fd16e35-18a1-4fc0-8d1a-e43cc95ec990.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '8fd16e35-18a1-4fc0-8d1a-e43cc95ec990' {
Properties @{
DisplayName = 'Audit OS and data disks encrypted without a customer-managed key'
Description = 'Audit if the OS or data disk is encrypted without a customer-managed key.'
Category = 'Compute'
Version = '1.0.0'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.Compute/disks' {
Require 'encryption.type is EncryptionAtRestWithCustomerKey' {
Field encryption.type | Must -Be 'EncryptionAtRestWithCustomerKey'
}
}
Effect (Param Effect)
}Source: policyDefinitions/Compute/audit-os-and-data-disks-encrypted-without-a-customer-managed-key/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw