Gallery › Storage › Azure Community Policy
Storage Account - Customer Managed Keys Blob and File Storage AUDIT
Converted Policy Audit Disabled Mode All Version 1.0.0
This Azure Policy creates an audit event when the 'Encryption type' setting is not set to 'Customer-managed keys'.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 46 lines
{
"name": "e6b2c041-120a-4a3e-9d61-804d67e6c470",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Storage Account - Customer Managed Keys Blob and File Storage AUDIT",
"description": "This Azure Policy creates an audit event when the 'Encryption type' setting is not set to 'Customer-managed keys'.",
"metadata": {
"version": "1.0.0",
"category": "Storage"
},
"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.Storage/storageAccounts"
},
{
"not": {
"field": "Microsoft.Storage/storageAccounts/encryption.keySource",
"equals": "Microsoft.Keyvault"
}
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylawe6b2c041-120a-4a3e-9d61-804d67e6c470.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'e6b2c041-120a-4a3e-9d61-804d67e6c470' {
Properties @{
DisplayName = 'Storage Account - Customer Managed Keys Blob and File Storage AUDIT'
Description = 'This Azure Policy creates an audit event when the ''Encryption type'' setting is not set to ''Customer-managed keys''.'
Version = '1.0.0'
Category = 'Storage'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.Storage/storageAccounts' {
Require 'encryption.keySource is Microsoft.Keyvault' {
Field encryption.keySource | Must -Be 'Microsoft.Keyvault'
}
}
Effect (Param Effect)
}Source: policyDefinitions/Storage/storage-account-customer-managed-keys-blob-and-file-storage-audit/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw