Gallery › Storage › Azure built-in policies
Storage accounts should use customer-managed key for encryption (excluding storage accounts managed by Azure Red Hat OpenShift)
Converted Policy Audit Disabled Mode Indexed Version 1.0.0
Secure your blob and file storage account with greater flexibility using customer-managed keys. When you specify a customer-managed key, that key is used to protect and control access to the key that encrypts your data. Using customer-managed keys provides additional capabilities to control rotation of the key encryption key or cryptographically erase data. Storage accounts in resource groups managed by Azure Red Hat OpenShift are excluded from evaluation.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "Storage accounts should use customer-managed key for encryption (excluding storage accounts managed by Azure Red Hat OpenShift)",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Secure your blob and file storage account with greater flexibility using customer-managed keys. When you specify a customer-managed key, that key is used to protect and control access to the key that encrypts your data. Using customer-managed keys provides additional capabilities to control rotation of the key encryption key or cryptographically erase data. Storage accounts in resource groups managed by Azure Red Hat OpenShift are excluded from evaluation.",
"metadata": {
"version": "1.0.0",
"category": "Storage"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"value": "[resourcegroup().managedBy]",
"notContains": "/providers/Microsoft.RedHatOpenShift/"
},
{
"not": {
"field": "Microsoft.Storage/storageAccounts/encryption.keySource",
"equals": "Microsoft.Keyvault"
}
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/f5c8be13-ecfa-4ed7-beee-fcd8a6d9519d",
"name": "f5c8be13-ecfa-4ed7-beee-fcd8a6d9519d"
}# Converted from StorageAccountCustomerManagedKeyEnabledWithAROExcluded_Audit.json by ConvertTo-Bylaw.
Policy 'f5c8be13-ecfa-4ed7-beee-fcd8a6d9519d' {
Properties @{
DisplayName = 'Storage accounts should use customer-managed key for encryption (excluding storage accounts managed by Azure Red Hat OpenShift)'
Description = 'Secure your blob and file storage account with greater flexibility using customer-managed keys. When you specify a customer-managed key, that key is used to protect and control access to the key that encrypts your data. Using customer-managed keys provides additional capabilities to control rotation of the key encryption key or cryptographically erase data. Storage accounts in resource groups managed by Azure Red Hat OpenShift are excluded from evaluation.'
Version = '1.0.0'
Category = 'Storage'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Storage/storageAccounts' {
When {
Arm '[resourcegroup().managedBy]' | Must -Not -ContainText '/providers/Microsoft.RedHatOpenShift/'
}
Require 'encryption.keySource is Microsoft.Keyvault' {
Field encryption.keySource | Must -Be 'Microsoft.Keyvault'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Storage/StorageAccountCustomerManagedKeyEnabledWithAROExcluded_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw