Gallery › Storage › Azure built-in policies
Storage account public access should be disallowed
Converted Policy Audit Deny Disabled Mode Indexed Version 3.1.1
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, Microsoft recommends preventing public access to a storage account unless your scenario requires it.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONASC_Storage_DisallowPublicBlobAccess_Audit.json · 78 lines
{
"properties": {
"displayName": "Storage account public access should be disallowed",
"policyType": "BuiltIn",
"mode": "Indexed",
"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, Microsoft recommends preventing public access to a storage account unless your scenario requires it.",
"metadata": {
"version": "3.1.1",
"category": "Storage"
},
"version": "3.1.1",
"parameters": {
"effect": {
"type": "string",
"metadata": {
"displayName": "Effect",
"description": "The effect determines what happens when the policy rule is evaluated to match"
},
"allowedValues": [
"audit",
"Audit",
"deny",
"Deny",
"disabled",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"not": {
"allOf": [
{
"field": "id",
"contains": "/resourceGroups/aro-"
},
{
"anyOf": [
{
"field": "name",
"like": "cluster*"
},
{
"field": "name",
"like": "imageregistry*"
}
]
}
]
}
},
{
"not": {
"field": "Microsoft.Storage/storageAccounts/allowBlobPublicAccess",
"equals": "false"
}
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"3.1.1",
"3.1.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/4fa4b6c0-31ca-4c0d-b10d-24b96f62a751",
"name": "4fa4b6c0-31ca-4c0d-b10d-24b96f62a751"
}Bylaw4fa4b6c0-31ca-4c0d-b10d-24b96f62a751.bylaw.ps1 · 39 lines
# Converted from ASC_Storage_DisallowPublicBlobAccess_Audit.json by ConvertTo-Bylaw.
Policy '4fa4b6c0-31ca-4c0d-b10d-24b96f62a751' {
Properties @{
DisplayName = 'Storage account public access should be disallowed'
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, Microsoft recommends preventing public access to a storage account unless your scenario requires it.'
Version = '3.1.1'
Category = 'Storage'
PolicyVersion = '3.1.1'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('audit', 'Audit', 'deny', 'Deny', 'disabled', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'The effect determines what happens when the policy rule is evaluated to match'
}
Resource 'Microsoft.Storage/storageAccounts' {
When {
AnyOf {
Field id | Must -Not -ContainText '/resourceGroups/aro-'
AllOf {
Field name | Must -Not -BeLike 'cluster*'
Field name | Must -Not -BeLike 'imageregistry*'
}
}
}
Require 'allowBlobPublicAccess is false' {
Field allowBlobPublicAccess | Must -Be 'false'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Storage/ASC_Storage_DisallowPublicBlobAccess_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw