Gallery › Storage › Azure Community Policy
Storage Account - Access Key Setting DENY
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
This Azure Policy denies the deployment of an Azure Storage Account 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 · 45 lines
{
"name": "9243143b-99f3-4948-8cf0-ad4076a7de3d",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Storage Account - Access Key Setting DENY",
"description": "This Azure Policy denies the deployment of an Azure Storage Account 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": "Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"field": "Microsoft.Storage/storageAccounts/allowSharedKeyAccess",
"notEquals": "false"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw9243143b-99f3-4948-8cf0-ad4076a7de3d.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '9243143b-99f3-4948-8cf0-ad4076a7de3d' {
Properties @{
DisplayName = 'Storage Account - Access Key Setting DENY'
Description = 'This Azure Policy denies the deployment of an Azure Storage Account when the ''Allow storage account key access'' setting is not set to ''Disabled''.'
Version = '1.0.0'
Category = 'Storage'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Deny, 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-deny/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw