Sequence 8 โ€” Network Security: Firewalls, VNets & Private Endpoints

Prerequisites: Sequences 1-7 (storage accounts, redundancy, authorization with keys/SAS/Entra). ยท What you'll be able to do: (1) lock down a storage account's public endpoint with firewall rules; (2) allow trusted networks via IP ranges, VNet service endpoints, resource instances and trusted-service exceptions; (3) deploy a private endpoint and explain the privatelink DNS flow; (4) decide service endpoint vs. private endpoint. ยท Est. time: ~16 min.

Network rules are a perimeter control: they decide which networks may reach the account. They are not authentication. Network rules + authorization always stack โ€” a request must pass the firewall and present a valid access key, SAS, or Microsoft Entra credential (Sequences 6-7). Passing the firewall never grants data access by itself.

1. The two endpoints of a storage account

Every storage account is reachable through two distinct front doors:

EndpointReached viaSecured by
Public endpointA public IP over the internet (account.blob.core.windows.net)Storage firewall rules and/or a network security perimeter
Private endpointA private IP from your VNet over Azure Private LinkThe Private Link consent flow (not firewall rules)

Two baseline hardening settings apply regardless of which path you use:

  • Secure transfer required โ€” accept HTTPS only; reject HTTP. On by default; recommended on. (Exception: NFS Azure file shares secured at the network level.)
  • Firewall rules affect the public endpoint only. They do not affect private-endpoint traffic.
public IPalloweddeniedprivate IPInternet clientStoragefirewallPublic endpoint403 blockedVM in your VNetPrivate endpointPrivate LinkStorage accountAuthorizationkey / SAS / Entra

2. Public network access: the master switch

Before any firewall rule matters, you set the account's default public network access to one of three states:

SettingMeaningEffect of firewall rules
Enabled from all networksDefault for new accounts. Open to the whole internet.Rules are ignored โ€” "allow all".
Enabled from selected virtual networks and IP addressesLocked down: deny by default, allow only listed sources.This is where IP / VNet / resource-instance rules take effect.
DisabledNo public access at all. Only private endpoints (and the trusted-services exception) can reach the account.Public rules are moot; use private endpoints.

Key fact: Firewall rules only have effect once the default action is Deny ("selected networks"). On the open default, your carefully crafted rules do nothing. In PowerShell/CLI this is literally -DefaultAction Deny / --default-action Deny.

Lock-out warning: flipping to Deny can cut off you and your apps. Add your allowed sources (or a private endpoint) first, then set Deny.

# Lock down: deny by default, keep trusted-Azure-services + logging/metrics on
az storage account update \
  --resource-group myresourcegroup --name mystorageaccount \
  --default-action Deny \
  --bypass AzureServices Logging Metrics

3. The four firewall rule types

Once on "selected networks", you grant access with four kinds of rules. They are OR-combined: a request is allowed if it matches any rule; otherwise it is denied.

Rule typeAllows traffic fromLimitNotes
IP network ruleSpecific public IPv4 ranges (single IP or CIDR)up to 400No private RFC 1918 ranges (10.x, 172.16-31.x, 192.168.x) โ€” rejected.
Virtual network ruleSpecific subnets via a service endpointup to 400Subnet may be in any subscription/tenant/region.
Resource instance ruleA specific Azure resource by its system-assigned identityโ€”For resources that can't be pinned to an IP/VNet. Same tenant.
Trusted-service exceptionAllowlisted Microsoft first-party servicesโ€”A bypass, not a rule. Service uses strong auth.

IP network rules

For clients outside any VNet โ€” e.g. an on-premises office's internet-facing public IP, or an ExpressRoute Microsoft-peering NAT IP. Use individual addresses or CIDR blocks.

az storage account network-rule add \
  --resource-group myresourcegroup --account-name mystorageaccount \
  --ip-address 203.0.113.0/24

Gotcha: if a subnet has a service endpoint for Storage, its traffic arrives with a private source IP, so IP rules no longer apply to it โ€” use a VNet rule for that subnet instead.

Virtual network rules (service endpoints)

A VNet rule trusts a subnet. The subnet must have the Microsoft.Storage (same region) or Microsoft.Storage.Global (cross-region) service endpoint enabled โ€” only one of the two per subnet.

Service endpointResource nameReaches
Azure StorageMicrosoft.StorageAccounts in the same region as the VNet
Azure Storage cross-regionMicrosoft.Storage.GlobalAccounts in any region

The portal creates the service endpoint automatically when you add the subnet; CLI/PowerShell need two steps (enable endpoint, then add rule). Adding the rule needs the Microsoft.Network/virtualNetworks/subnets/joinViaServiceEndpoint/action permission (held by Storage Account Contributor).

# 1) Enable the service endpoint on the subnet
az network vnet subnet update \
  --resource-group myresourcegroup --vnet-name myvnet --name mysubnet \
  --service-endpoints "Microsoft.Storage.Global"

# 2) Add a VNet rule referencing that subnet
subnetid=$(az network vnet subnet show -g myresourcegroup --vnet-name myvnet --name mysubnet --query id -o tsv)
az storage account network-rule add -g myresourcegroup --account-name mystorageaccount --subnet $subnetid

DR tie-in: VNet rules also cover the RA-GRS read-only secondary. Pre-create paired-region VNets with Storage service endpoints so access survives a regional failover (see Sequence 3). Microsoft.Storage.Global also enables access from a paired region.

Subnet pitfall: delete a subnet and its rule is dropped; recreating a subnet of the same name does not restore access โ€” you must re-add the rule explicitly.

Resource instance rules

Some PaaS resources (e.g. a Logic App, Azure ML workspace, Synapse) can't be pinned to a stable IP or VNet. Allow them by their system-assigned managed identity / resource ID. The resource's RBAC role assignments still govern what operations it may perform.

Trusted-service exception

A toggle (bypass) that lets allowlisted Microsoft first-party services reach the account from outside your network boundary โ€” commonly to write resource logs/metrics or for backup/Defender. These services authenticate strongly. Keep Logging and Metrics in the bypass so diagnostics keep flowing.

4. How the rules are evaluated

No: all networksDisabledYesYesNoYesNoIncoming request to publicendpointPublic access = selectednetworks?Allowed by firewallDenied on public endpointMatches any IP / VNet /resource-instance rule,or a trusted-servicebypass?Allowed by firewall403 โ€” denied by defaultAuthorization:key / SAS / Entra valid?Access granted403 โ€” authorization failure

Mental model: once restricted, the firewall is default-deny with explicit allows (OR). There is no "deny rule" to override an allow โ€” you simply don't list a source. And clearing the firewall is never enough to reach data โ€” authorization (Step Z) is the second gate.

SAS note: a SAS that pins an IP range only narrows the token's reach. It can never widen access beyond the network rules โ€” the firewall is checked first.

A private endpoint is a network interface in your VNet that gets a private IP from your subnet and maps it to one storage service of the account over Private Link. Traffic rides the Microsoft backbone โ€” it never touches the public internet.

Key properties:

  • Per-service (per target sub-resource). You need a separate private endpoint for each service you use: blob, dfs (Data Lake), file, queue, table, web (static site). If you use Data Lake, create endpoints for both dfs and blob โ€” some ADLS operations redirect to blob.
  • Same code, no changes. Apps keep the same connection string and the same authorization (key/SAS/Entra). Do not connect via the raw privatelink URL.
  • Consent flow, not firewall. Approval happens through the Private endpoints tab (auto-approved if you own the account). When a private endpoint exists, its VNet's traffic is always allowed โ€” even if public access is Disabled.
  • Not on general-purpose v1. Use GPv2 (Standard or Premium).
  • For RA-GRS read access to the secondary, create a separate private endpoint for the secondary; but failover needs none โ€” the endpoint auto-reconnects to the new primary.
  • Private endpoints carry an extra cost (Private Link pricing) but give maximum isolation.

Creating a private endpoint does not auto-close the public endpoint. To fully isolate, also set the firewall to Deny / Disabled.

The DNS implication (this is the exam-favorite detail)

Creating the private endpoint rewrites DNS so the normal hostname resolves to the private IP from inside the VNet, while still resolving publicly from outside. A privatelink CNAME is inserted, and Azure (by default) creates a private DNS zone linked to the VNet with the A record pointing to the private IP.

DNSClient outside VNetVM inside VNetDNSClient outside VNetVM inside VNetresolve mysa.blob.core.windows.netCNAME -> mysa.privatelink.blob.core.windows.net -> A 10.1.1.5 (private)resolve mysa.blob.core.windows.netCNAME -> privatelink... -> public endpoint IP

Recommended private DNS zones per service:

Storage serviceSub-resourcePrivate DNS zone
Blobblobprivatelink.blob.core.windows.net
Data Lakedfsprivatelink.dfs.core.windows.net
Filefileprivatelink.file.core.windows.net
Queuequeueprivatelink.queue.core.windows.net
Tabletableprivatelink.table.core.windows.net
Static websitewebprivatelink.web.core.windows.net

With custom/on-prem DNS, you must delegate the privatelink subdomain to the Azure private DNS zone or add the A records yourself, so on-prem clients (over VPN/ExpressRoute private peering) resolve to the private IP.

6. Service endpoints vs. private endpoints โ€” when to choose which

AspectService endpoint (VNet rule)Private endpoint (Private Link)
What it doesTrusts a subnet to reach the public endpoint over an optimized pathPuts a private IP for the account into your VNet
IP addressingUses the account's public endpointUses a private IP from your subnet
GranularityWhole storage service, per regionPer service (blob/file/...), per account
CostFreeBilled (Private Link)
On-premises reachNot natively (still public endpoint)Yes, via VPN/ExpressRoute private peering
DNS workNonePrivate DNS zone required
Isolation levelGoodMaximum (no public internet path)

Choose service endpoints for quick, free lock-down of in-Azure VNet workloads. Choose private endpoints when you need a private IP, on-premises private access, or public access fully Disabled. They coexist โ€” a subnet can use a service endpoint for one account and a private endpoint for another.

(Preview) Permitted scope for copy operations can restrict copy sources to the same Entra tenant or Private Link VNet, blocking data infiltration.

Key takeaways

  • Network rules โ‰  auth. Both gates must pass: firewall AND (key/SAS/Entra).
  • Three public-access states: all networks (open default) ยท selected networks (deny-by-default + allows) ยท Disabled (private endpoints only).
  • Rules do nothing until default action = Deny. Allow your sources first, then Deny โ€” or lock yourself out.
  • Four rule types: IP (public ranges/CIDR, no RFC 1918), VNet (subnet + Microsoft.Storage / Microsoft.Storage.Global service endpoint), resource instance (by identity), trusted-service bypass. Rules are OR / default-deny.
  • Service endpoint enabled โ‡’ subnet uses a private source IP โ‡’ IP rules stop applying to it.
  • Private endpoint = private IP in your VNet via Private Link, per service, traffic on Microsoft backbone, VNet always allowed even if public Disabled. DNS: privatelink zone, same connection string. Data Lake โ‡’ need both dfs + blob.
  • Service endpoint = free, public IP, subnet-level; Private endpoint = paid, private IP, on-prem-capable, max isolation.

Exercises

  1. (Recall) What are the three values of the storage account's public network access setting?
  2. (Recall) You added an IP rule and a VNet rule but traffic from the internet is still wide open. What single setting did you forget?
  3. (Applied) A subnet has the Microsoft.Storage service endpoint enabled, yet your IP network rule for that subnet's egress IP no longer works. Why?
  4. (Applied) You enabled a private endpoint for the blob service on a Data Lake Storage (GPv2 hierarchical) account, but Create Directory operations fail. What's missing?
  5. (Scenario) Security requires zero public internet exposure, access only from an Azure VNet and an on-premises site over ExpressRoute, using existing app connection strings unchanged. Which network design do you implement, and what must you configure for on-prem DNS?
  6. (Concept) A client says "the firewall allows my IP, so the data should be readable without credentials." Correct them.
Answers
  1. Enabled from all networks (default), Enabled from selected virtual networks and IP addresses, and Disabled.
  2. The default action is still Allow ("all networks"). Set it to Deny ("selected networks") โ€” only then do rules take effect.
  3. With a service endpoint enabled, the subnet's traffic reaches Storage using a private source IP, not a public IP, so IP network rules no longer match it. Use a virtual network rule for that subnet instead.
  4. A private endpoint for the dfs (Data Lake) sub-resource. ADLS directory/ACL operations require the dfs endpoint; for ADLS accounts create both blob and dfs private endpoints.
  5. Use private endpoints (Private Link) for the needed services, then set the storage firewall's public network access to Disabled. The private endpoint's VNet is allowed automatically; on-prem reaches it over ExpressRoute private peering. Because apps keep the same hostname, configure on-prem/custom DNS to delegate the privatelink.<service>.core.windows.net subdomain to the Azure private DNS zone (or add the matching A records) so the FQDN resolves to the private IP.
  6. Wrong. Network rules only decide which networks may connect. Every allowed request must still authorize with a valid access key, SAS, or Microsoft Entra identity. The firewall is the first gate; authorization is a separate, mandatory second gate.

Coming up next

Sequence 9 โ€” Identity-Based Access for Azure Files: enabling Microsoft Entra / on-prem AD DS authentication over SMB, share-level and NTFS permissions, and how identity layers on top of the network controls you just built.