Skip to content
Cloud Governance Tools

Storage accounts should prevent shared key access

Storage accounts should prevent shared key access is an Azure guardrail written in Azure Policy. Denies storage accounts that allow Shared Key authorization, so requests must use Microsoft Entra ID. What it breaks: existing storage accounts that allow Shared Key are marked non-compliant but not changed.

More identity and privilege guardrails ยท About Azure Policy

Built-in policy definition: Storage accounts should prevent shared key access
Definition ID: 8c6a50c6-9ffd-4ae7-986f-5fa6111f9a54
Category: Storage
Supported effects: Audit, Deny, Disabled
policyRule (copied from the repository file):
{
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.Storage/storageAccounts"
        },
        {
          "anyOf": [
            {
              "value": "[contains(parameters('excludedManagedByResourceProviders'), 'Azure Red Hat OpenShift')]",
              "equals": false
            },
            {
              "value": "[resourcegroup().managedBy]",
              "notContains": "/providers/Microsoft.RedHatOpenShift/"
            }
          ]
        },
        {
          "anyOf": [
            {
              "value": "[contains(parameters('excludedManagedByResourceProviders'), 'Azure Databricks')]",
              "equals": false
            },
            {
              "value": "[resourcegroup().managedBy]",
              "notContains": "/providers/Microsoft.Databricks/"
            }
          ]
        },
        {
          "anyOf": [
            {
              "value": "[contains(parameters('excludedManagedByResourceProviders'), 'Microsoft Purview')]",
              "equals": false
            },
            {
              "value": "[resourcegroup().managedBy]",
              "notContains": "/providers/Microsoft.Purview/"
            }
          ]
        },
        {
          "anyOf": [
            {
              "value": "[contains(parameters('excludedManagedByResourceProviders'), 'All managed resource groups')]",
              "equals": false
            },
            {
              "value": "[empty(resourcegroup().managedBy)]",
              "equals": true
            }
          ]
        },
        {
          "anyOf": [
            {
              "anyOf": [
                {
                  "field": "Microsoft.Storage/storageAccounts/allowSharedKeyAccess",
                  "exists": "false"
                },
                {
                  "field": "Microsoft.Storage/storageAccounts/allowSharedKeyAccess",
                  "equals": ""
                }
              ]
            },
            {
              "field": "Microsoft.Storage/storageAccounts/allowSharedKeyAccess",
              "equals": "true"
            }
          ]
        }
      ]
    },
    "then": {
      "effect": "[parameters('effect')]"
    }
  }
Blocks
Denies storage accounts that allow Shared Key authorization, so requests must use Microsoft Entra ID.
Breaks
Existing storage accounts that allow Shared Key are marked non-compliant but not changed. (source)
Test before applying
As for every Azure Policy guardrail: how to test before enforcing
Mechanism
Azure Policy (built-in definitions): Resources at the scope of the assignment (management group, subscription, resource group) and their children, except notScopes and exemptions
Taken from
open source set, MIT License, Azure/azure-policy repository, https://raw.githubusercontent.com/Azure/azure-policy/master/LICENSE

What the source says

"Audit requirement of Azure Active Directory (Azure AD) to authorize requests for your storage account." (read 10 Nov 2026).

What it breaks is documented for every guardrail of this mechanism: see Azure Policy.

Sources

  1. Storage accounts should prevent shared key access, read 10 Nov 2026
  2. What it breaks, read 10 Nov 2026
  3. How to test it first, read 10 Nov 2026

Last reviewed 16 Nov 2026.