Skip to main content

Container Public Access Outlives the Account-Level Toggle

High severityAzure Storage About 20 minutes to fix

Overview

Flipping AllowBlobPublicAccess to false at the storage account gates new requests but never touches the publicAccess property already set on individual containers. Azure Policy audits report compliant while dormant Container or Blob access settings sit ready to reactivate the moment the account flag is reset by a redeploy.

At a glance

Symptom
A redeploy, migration, or template missing the explicit false override resets the account flag to its true default, reactivating every container's stale public access…
Likely cause
Account-level AllowBlobPublicAccess is set false while container-level publicAccess properties still hold Container or Blob from a prior configuration.
Impact
Every container that was ever configured for anonymous access becomes publicly readable again the moment the account-level gate reopens, with no deployment log flagging it.
Verification signal
Re-run the detection test and a controlled negative-path test.
Safe correction
Explicitly pin allow_nested_items_to_be_public/allowBlobPublicAccess false in every template and separately audit and reset container-level publicAccess to none via CLI or policy.
Rollback or recovery
Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.

The Trap

Blob public access is locked down at the storage account level, which masks container-level publicAccess settings that were never reverted.

The Default State

Older storage accounts, and accounts deployed from older ARM or Bicep templates, often have allowBlobPublicAccess set to true, although Microsoft now documents anonymous access as disallowed by default for new Azure Resource Manager accounts. Terraform’s azurerm_storage_account resource exposes the flag as allow_nested_items_to_be_public, which defaults to true in the 3.x and 4.x provider releases if the argument is omitted.

Engineers who later harden the account by setting the flag to false assume the job is done, because the portal’s container listing stops showing an ‘Anonymous’ badge and Azure Policy’s built-in definition ‘Storage account public access should be disallowed’ reports compliant.

What nobody checks is the publicAccess property stored on each individual container, which remains set to Container or Blob from whenever it was configured, untouched by the account-level change.

The Blast Radius

The account-level flag is a gate, not a wipe.

If a subsequent apply sets the flag back to true (an old template, or a Terraform module that omits allow_nested_items_to_be_public on a provider version that defaults it to true), or a migration script recreates the resource from such a template, every container still holding its old Container or Blob publicAccess setting is instantly and silently exposed to anonymous read again, with no change ticket, no alert, and no deployment log entry mentioning access control.

Compliance dashboards built solely on the account-level policy definition never flagged the residual container state, so the exposure looks like a fresh incident when it was actually pre-loaded weeks earlier.

The Lead Mechanic Fix

Treat account-level and container-level access as two separate controls requiring two separate remediations. First, lock the account: az storage account update –name <account> –resource-group <rg> –allow-blob-public-access false, and enforce it fleet-wide with an Azure Policy deny effect on Microsoft.Storage/storageAccounts allowBlobPublicAccess.

Second, audit every container regardless of account state: az storage container list –account-name <account> –query “[?properties.publicAccess!=null].{name:name,access:properties.publicAccess}” -o table, then force each result to none with az storage container set-permission –name <container> –account-name <account> –public-access off.

Pin allow_nested_items_to_be_public = false explicitly in every Terraform module rather than relying on inherited defaults, and, because no built-in policy definition covers the container-level setting, add a custom audit definition for it to the same initiative or schedule the container audit above, so container-level drift is caught independently of the account flag.

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.

Control to implement

Explicitly pin allow_nested_items_to_be_public/allowBlobPublicAccess false in every template and separately audit and reset container-level publicAccess to none via CLI or policy.

Validate the vendor-specific syntax in official documentation before applying it.

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.

More from KBY that goes with this config trap.