Gallery › Storage › Azure Community Policy
Storage account public access should be disallowed (block anonymous blob access)
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Anonymous public read access to containers and blobs in Azure Storage is a convenient way to share data but might present security risks. To prevent data breaches caused by undesired anonymous access, prevent public access to a storage account.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 56 lines
{
"name": "f4ac74bb-59d1-42ee-a7fb-e9b9f525fb03",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Storage account public access should be disallowed (block anonymous blob access)",
"description": "Anonymous public read access to containers and blobs in Azure Storage is a convenient way to share data but might present security risks. To prevent data breaches caused by undesired anonymous access, prevent public access to a storage account.",
"metadata": {
"category": "Storage",
"createdBy": "",
"updatedBy": null,
"updatedOn": null,
"version": "1.0.0"
},
"mode": "Indexed",
"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": [
{
"equals": "Microsoft.Storage/storageAccounts",
"field": "type"
},
{
"anyOf": [
{
"equals": "true",
"field": "Microsoft.Storage/storageAccounts/allowBlobPublicAccess"
},
{
"exists": "false",
"field": "Microsoft.Storage/storageAccounts/allowBlobPublicAccess"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylawf4ac74bb-59d1-42ee-a7fb-e9b9f525fb03.bylaw.ps1 · 31 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'f4ac74bb-59d1-42ee-a7fb-e9b9f525fb03' {
Properties @{
DisplayName = 'Storage account public access should be disallowed (block anonymous blob access)'
Description = 'Anonymous public read access to containers and blobs in Azure Storage is a convenient way to share data but might present security risks. To prevent data breaches caused by undesired anonymous access, prevent public access to a storage account.'
Category = 'Storage'
Version = '1.0.0'
Mode = 'Indexed'
}
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 'allowBlobPublicAccess is not true' {
Field allowBlobPublicAccess | Must -Not -Be 'true' -IfPresent
}
Require 'allowBlobPublicAccess exists' {
Field allowBlobPublicAccess | Must -Exist
}
}
Effect (Param Effect)
}Source: policyDefinitions/Storage/storage-account-public-access-should-be-disallowed-block-anonymous-blob-access/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw