Search code examples
azureazure-storageazure-blob-storageazure-policy

Azure Policy - Check Blob container access level


I am creating a policy to check if the Blob container access level is set to "Anonymous" in Azure Storage accounts.

This is the policy that i have created.

{
    "properties": {
        "displayName": "check if Blob container access level is set to Anonymous",
        "description": "check the container access level",
        "mode": "all",
        "policyRule": {
                "if": {
                  "allOf": [
                    {
                      "field": "type",
                      "equals": "Microsoft.Storage/storageAccounts/blobServices/containers"
                    },
                    {
                      "not": {
                        "field": "Microsoft.Storage/storageAccounts/containers/publicAccess",
                        "equals": "False"
                      }
                    }
                  ]
                },
                "then": {
                  "effect": "Audit"
                }
              }
            }
}

Its not able to detect the container access level.


Solution

  • As the issue said, Storage team is releasing public access setting on storage account towards Jun 30 2020. Customers can use it to control the public access on all containers in the storage account.

    After it's released on storage, we will work with Azure Policy team to integrate the setting with Azure Policy so customers can us Azure Policy to audit and govern public access across storage accounts.

    We work the best to ship above features and capabilities as early as possible.