Azure Storage 403 After Disabling Shared Key Access: Find and Fix Key-Based Clients
Overview
When Allow storage account key access is disabled, Azure Storage returns 403 to every request signed with account keys, including service and account SAS. Find those clients with metrics and StorageBlobLogs, move them to Microsoft Entra ID roles or user delegation SAS, and re-allow Shared Key only temporarily, with approval, a WhatIf preview and rollback.
Diagnose
Symptom
What responders observe.
Someone set Allow storage account key access to Disabled under Settings, Configuration in the Azure portal, or ran the equivalent PowerShell, Azure CLI or template change ("allowSharedKeyAccess": false). Soon after:applications using a connection string with an account key, or a service or account SAS, receive 403 (Forbidden), and Azure Storage reports that key-based authorisation is not permitted on the account;Azure CLI data commands that omit --auth-mode or use --auth-mode key fail, because they try to use the account key;Cloud Shell files kept on this account become inaccessible, and portal access to Azure Files fails without the right RBAC assignments.
Detection
Metrics, logs and confirmation commands.
-
All steps are read-only. Record each output in the incident log.
-
Measure Shared Key and SAS traffic. In the portal open the storage account, Monitoring, Metrics. Set Metric Namespace to Account, Metric to Transactions, Aggregation to Sum, then add a filter: Property Authentication, Operator =, Values Account Key and SAS. Metrics do not separate SAS types here, so the count can include user delegation SAS, which still works.Name the failing clients (Log Analytics Reader on the workspace; needs a diagnostic setting that was already sending StorageBlobLogs):StorageBlobLogs | where AuthenticationType in ("AccountKey", "SAS") and TimeGenerated > ago(7d) | summarize count() by CallerIpAddress, UserAgentHeader, AccountName | top 10 by count_ descExpected: the clients still using keys or SAS. To keep only the rejected calls, add | where StatusCode == "403" before summarize. Stop and escalate if no diagnostic setting existed: logs are not collected retrospectively, so add one now and identify clients from application owners and the 403 errors they report.Classify each client. An account key in a connection string or in AZURE_STORAGE_KEY, CLI data commands without --auth-mode login, and service or account SAS are all Shared Key. A user delegation SAS (it carries skoid and sktid fields) is Microsoft Entra ID. Flag Azure Files and Cloud Shell use separately.
Root cause
Why the incident occurred.
-
All steps are read-only.
-
Record each output in the incident log.
-
Measure Shared Key and SAS traffic.
-
In the portal open the storage account, Monitoring, Metrics.
-
Set Metric Namespace to Account, Metric to Transactions, Aggregation to Sum, then add a filter: Property Authentication, Operator =, Values Account Key and SAS.
-
Metrics do not separate SAS types here, so the count can include user delegation SAS, which still works.Name the failing clients (Log Analytics Reader on the workspace; needs a diagnostic setting that was already sending StorageBlobLogs):StorageBlobLogs | where AuthenticationType in ("AccountKey", "SAS") and TimeGenerated > ago(7d) | summarize count() by CallerIpAddress, UserAgentHeader, AccountName | top 10 by count_ descExpected: the clients still using keys or SAS.
-
To keep only the rejected calls, add | where StatusCode == "403" before summarize.
-
Stop and escalate if no diagnostic setting existed: logs are not collected retrospectively, so add one now and identify clients from application owners and the 403 errors they report.Classify each client.
-
An account key in a connection string or in AZURE_STORAGE_KEY, CLI data commands without --auth-mode login, and service or account SAS are all Shared Key.
-
A user delegation SAS (it carries skoid and sktid fields) is Microsoft Entra ID.
-
Flag Azure Files and Cloud Shell use separately.
Contain and prevent
Blast radius
What else this can affect.
Prevention
Controls and guardrails that stop it recurring.
-
List every account’s setting with Azure Resource Graph:resources | where type =~ 'Microsoft.Storage/storageAccounts' | extend allowSharedKeyAccess = parse_json(properties).allowSharedKeyAccess | project subscriptionId, resourceGroup, name, allowSharedKeyAccessAssign Storage accounts should prevent shared key access in Audit mode, enable diagnostic settings and an alert on Shared Key requests, and switch the policy to Deny only once Metrics show no Account Key or SAS traffic.
-
A policy change can take up to 30 minutes to take effect.Restrict Owner, Contributor and Storage Account Contributor: each can list keys.
Fix
Pre-flight checks
Check these before you change anything.
-
Reader on the storage account and Log Analytics Reader on its workspace.
-
Azure CLI 2.20.0 or later and Az.Storage 3.4.0 or later.
-
Approval from the service owner before any state change.
Commands
az storage account show --name <storage-account> --resource-group <resource-group> --query "allowSharedKeyAccess"
StorageBlobLogs | where AuthenticationType in ("AccountKey", "SAS") and TimeGenerated > ago(7d) | summarize count() by CallerIpAddress, UserAgentHeader, AccountName | top 10 by count_ desc
az role assignment list --assignee <assignee> --scope <scope>
az role assignment create --role "Storage Blob Data Reader" --assignee <assignee> --scope <container-scope>
az storage container generate-sas --account-name <storage-account> --name <container> --permissions r --expiry <date-time> --auth-mode login --as-user
Set-AzStorageAccount -ResourceGroupName <resource-group> -Name <storage-account> -AllowSharedKeyAccess $true -WhatIf
Set-AzStorageAccount -ResourceGroupName <resource-group> -Name <storage-account> -AllowSharedKeyAccess $true
az storage blob list --account-name <storage-account> --container-name <container> --num-results 5 --auth-mode login
Verify and recover
Verification
Evidence required before you close the incident.
-
az storage account show ... --query "allowSharedKeyAccess" — false after A; true during B — Value matches the chosen remediation.
-
az storage blob list ... --num-results 5 --auth-mode login as the client identity — Blobs listed without 403 — Call succeeds after role propagation.
-
StorageBlobLogs query filtered on StatusCode == "403" — No new rows for remediated clients over an hour — 403 errors stop and OAuth transactions rise.
Commands in these steps
az storage account show ... --query "allowSharedKeyAccess" — false after A; true during B — Value matches the chosen remediationaz storage blob list ... --num-results 5 --auth-mode login as the client identity — Blobs listed without 403 — Call succeeds after role propagation
Rollback
The safe way back.
-
Remediation A: run az role assignment list with the same --assignee, --role and --scope, confirm only the new assignment matches, then az role assignment delete with those arguments.
-
Remediation A (SAS): stop distributing the user delegation SAS
-
it expires at its expiry time and within 7 days at most.
-
Remediation B: Set-AzStorageAccount -ResourceGroupName <resource-group> -Name <storage-account> -AllowSharedKeyAccess $false, or az storage account update --name <storage-account> --resource-group <resource-group> --allow-shared-key-access false
-
confirm the show query returns false.
Escalate when
Conditions that need another owner.
-
Requests using Microsoft Entra ID still return 403 after role assignment and a propagation wait: escalate to the identity or network owner with the role list and log rows.
-
The cause lies outside this runbook.Azure Policy Deny blocks an approved rollback.Azure Files or Cloud Shell users depend on the account.No logs exist and owners cannot name the failing clients in time.
Fixed? Get the next one before it hits you: The KBY Brief
Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.
About this page
Credited to
Dates
Published
Corrections
No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Sources
Based on the vendor sources listed below. Check each step against your environment before acting.
First published 16 November 2026
Prevent Shared Key authorization for an Azure Storage account
Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.
Set-AzStorageAccount (Az.Storage)
Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.
Choose how to authorize access to blob data with Azure CLI
Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.
Assign an Azure role for access to blob data
Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.
Create a user delegation SAS for a container or blob with the Azure CLI
Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.
Azure Blob Storage monitoring data reference
Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.
StorageBlobLogs table reference
Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.
az role assignment (Azure CLI)
Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.
az storage account (Azure CLI)
Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.
az storage blob (Azure CLI)
Cited for: Supports the documented platform behaviour, diagnosis or recovery controls used by this Runbook.