Storage account network rules may allow broad access

Limit public network access to the clients that need the storage account, and review allowed sources and service exceptions.

Description

When an Azure Storage public endpoint is enabled, network_acls.default_action: Allow accepts connections from any network. With Deny, address rules and service exceptions determine who can still connect. The account's public_network_access setting takes precedence over the firewall default.

Potential impact

Broad network access can let someone use leaked credentials or excessive permissions from outside the intended network. Whether they can read or write data depends on separate access settings, including anonymous access.

Remediation

  1. If you need the public endpoint, set network_acls.default_action to Deny. Allow only the required public IPv4 addresses or virtual networks, and limit resource-instance rules and bypass exceptions.
  2. Use the public source address Azure sees for each client. IP rules do not apply to requests from the same Azure region. Use virtual network rules there when needed.
  3. For private access only, configure private endpoints and DNS for the storage services in use, then set public_network_access: Disabled. Check which service and resource-instance exceptions remain. Test allowed and blocked connections and review data permissions after the change.

Examples

The account name changes from clh0003 to clh0002 in these examples. To update an existing account, use its name in both tasks. Supply a real resource group and authentication settings, and choose an available name for a new account.

Before

yaml
- name: configure firewall and more virtual networks
  azure_rm_storageaccount:
    resource_group: myResourceGroup
    name: clh0003
    type: Standard_RAGRS
    network_acls:
      bypass: AzureServices,Metrics
      default_action: Allow

After

yaml
- name: configure firewall and virtual networks
  azure_rm_storageaccount:
    resource_group: myResourceGroup
    name: clh0002
    type: Standard_RAGRS
    network_acls:
      bypass: AzureServices,Metrics
      default_action: Deny
      ip_rules:
        - value: 1.2.3.4
          action: Allow

The second task changes the default from Allow to Deny. Replace 1.2.3.4 with the approved client’s public address. The exceptions in bypass: AzureServices,Metrics still apply.

References