Gallery › Storage › Azure Community Policy
Storage Account - Access Key Setting AUDIT
Converted Policy Audit Disabled Mode All Version 1.0.0
This Azure Policy creates an audit event when the 'Allow storage account key access' setting is not set to 'Disabled'.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 44 lines
{
"name": "7ff1d05b-a251-4fd3-ad93-3834840ec6a9",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Storage Account - Access Key Setting AUDIT",
"description": "This Azure Policy creates an audit event when the 'Allow storage account key access' setting is not set to 'Disabled'.",
"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"
},
{
"field": "Microsoft.Storage/storageAccounts/allowSharedKeyAccess",
"notEquals": "false"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw7ff1d05b-a251-4fd3-ad93-3834840ec6a9.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '7ff1d05b-a251-4fd3-ad93-3834840ec6a9' {
Properties @{
DisplayName = 'Storage Account - Access Key Setting AUDIT'
Description = 'This Azure Policy creates an audit event when the ''Allow storage account key access'' setting is not set to ''Disabled''.'
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 'allowSharedKeyAccess is false' {
Field allowSharedKeyAccess | Must -Be 'false'
}
}
Effect (Param Effect)
}Source: policyDefinitions/Storage/storage-account-access-key-setting-audit/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw