Skip to main content

Storage Account Keys Still Bypass Azure RBAC

High severityAzure Storage About 20 minutes to fixGenerated 16 Jul 2026

Overview

A storage account with Azure RBAC still grants full data-plane access to anyone holding its account key, because shared-key authentication never consults Microsoft Entra ID. RBAC, Conditional Access and MFA are skipped whenever a leaked key reaches blob, Azure Files, queue or table data.

At a glance

Symptom
A leaked account key or classic SAS token is presented to the data plane, bypassing Azure AD RBAC and Conditional Access entirely.
Likely cause
allowSharedKeyAccess (Allow storage account key access) left set to true on the storage account.
Impact
Full read, write and delete access to blobs, queues and tables regardless of RBAC role assignments, with no Conditional Access or MFA enforcement.
Verification signal
Re-run the detection test and a controlled negative-path test.
Safe correction
Set shared_access_key_enabled/allowSharedKeyAccess to false and enforce it via Azure Policy definition 6b1cbf55-e8b6-442f-ba4c-a25a6ba1c99a.
Rollback or recovery
Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.

The Trap

The allowSharedKeyAccess property on an Azure Storage Account, exposed in the portal as “Allow storage account key access”, remains set to true long after teams have layered Azure RBAC roles such as Storage Blob Data Reader or Storage Blob Data Contributor on top. Engineers treat those role assignments as the access control boundary and never realise that a completely separate, older authentication path is still live on the same account.

The Default State

Every new storage account, whether provisioned via the Azure Portal, CLI, ARM template, or the azurerm_storage_account Terraform resource, ships with shared key authorisation enabled unless a value is explicitly set. Most Terraform modules omit the shared_access_key_enabled argument entirely, inheriting the provider default of true. Developers also routinely pull the primary or secondary key from the Access Keys blade to build connection strings for App Service, Functions, or local development, cementing key-based access as the working pattern rather than the exception.

The Blast Radius

Shared key authentication does not authenticate against Azure AD at all. It validates a symmetric HMAC signature derived from the account key, so it has no concept of RBAC role assignments, Conditional Access policies, MFA, or sign-in risk. Anyone holding the key, whether pulled from a Key Vault secret, a pipeline variable, a stale .env file, or a leaked application setting, gets full read, write and delete access to every blob, file share, queue and table in the account regardless of how tightly RBAC has been scoped. Classic SAS tokens minted from that key inherit the same bypass, since they are not tied to an Azure AD identity like a user delegation SAS is. Key rotation is frequently neglected for months or years, so a single historic leak stays exploitable indefinitely, and Defender for Storage anomaly detection is built around unusual access patterns, not correctly signed key-based requests that look entirely legitimate.

The Lead Mechanic Fix

Disable shared key authorisation directly on the resource: az storage account update --name <name> --resource-group <rg> --allow-shared-key-access false, or in Terraform set shared_access_key_enabled = false on azurerm_storage_account. Enforce it at scale with the built-in policy “Storage accounts should prevent shared key access” (8c6a50c6-9ffd-4ae7-986f-5fa6111f9a54), assigned in Audit mode first and moved to Deny one subscription or resource group at a time, targeting the Microsoft.Storage/storageAccounts field properties.allowSharedKeyAccess. Before flipping the switch, check the storage resource logs for requests authorised with the account key or a key-signed SAS, test in non-production, and audit every App Service connection string, Function App setting (including AzureWebJobsStorage), and Terraform state file for AccountKey= references, since this change breaks any workload still authenticating via shared key the moment it is applied, with no grace period. Rollback is --allow-shared-key-access true.

3

Apply the safer control

Before you change production

Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.

Fix commands and configuration

az storage account update --name <name> --resource-group <rg> --allow-shared-key-access false
shared_access_key_enabled = false
azurerm_storage_account
4

Verify, roll back or escalate

Verify

Re-run the detection test and a controlled negative-path test. Confirm the unsafe behaviour is blocked while approved traffic still succeeds.

Rollback

Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.

Escalate

Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.

The KBY Brief

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

Last updated

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.

After remediation

Further reading stays below the corrective workflow and is selected by platform, category and shared technical keywords.

Discover more

Connected KBY resources

Storage Account Keys Still Bypass Azure RBAC | Config Traps