Azure Blob container permits public access

Restrict anonymous reads of Azure Blob containers to prevent unintended disclosure of file contents and listings.

Description

Set publicAccess: 'None' on containers that must be private. The account-level allowBlobPublicAccess: false blocks anonymous reads for every container, so check whether existing clients depend on public content before applying it.

Potential impact

Where the account and network permit it, Blob allows anonymous reads of known blobs. Container also allows listing their names. Neither grants anonymous writes.

Remediation

Keep intentionally public files separate from private documents and backups. From an allowed network, verify that anonymous reads and listings fail and authorized requests succeed. Review data roles and SAS scope and expiry because existing credentials and SAS tokens can still grant access.

Examples

Supply an existing account and valid container name. The Blob service is default. The first excerpt assumes the account already permits anonymous reads. Keep existing account safeguards in place.

Before

bicep
param storageAccountName string
param containerName string

resource blob_container_example 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-02-01' = {
  name: '${storageAccountName}/default/${containerName}'
  properties: {
    denyEncryptionScopeOverride: true
    publicAccess: 'Container'
    metadata: {}
  }
}

After

bicep
param storageAccountName string
param containerName string

resource blob_container_example 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-02-01' = {
  name: '${storageAccountName}/default/${containerName}'
  properties: {
    denyEncryptionScopeOverride: true
    publicAccess: 'None'
    metadata: {}
  }
}

References