Network Security: NSGs, ASGs, Azure Virtual Network Manager
L3/L4 segmentation on Azure β Network Security Groups, Application Security Groups for label-based rules, and Azure Virtual Network Manager (AVNM) for centralised network access policies across many VNets.
The L3/L4 layer of Azure networking security
Network Security Groups (NSGs) are Azureβs stateful firewall at the subnet or NIC level β allow/deny rules based on source/destination IP, port, and protocol. They are simple, free, and applied close to the workload. Theyβre the bread-and-butter L3/L4 control.
Application Security Groups (ASGs) let you reference groups of NICs by name in NSG rules instead of CIDR ranges. βAllow web-tier ASG to talk to db-tier ASG on 3306β is much more maintainable than βallow 10.5.6.0/26 to 10.5.7.0/26 on 3306β.
Azure Virtual Network Manager (AVNM) is the newer centralised network manager β define hub-and-spoke connectivity, mesh connectivity, and security admin rules at scale across many VNets in one place. AVNM security admin rules even take priority over NSG rules β Azure-side enforcement.
Network Security Groups (NSGs)
Scope and rule structure
NSGs apply at subnet (recommended for fleet management) or NIC (fine-grained, used for exceptions). Each NSG has up to 1000 rules across inbound and outbound. Each rule has:
- Priority (100β4096, lower wins)
- Source β IP/CIDR, service tag, ASG, or
* - Destination β same options
- Protocol β TCP/UDP/ICMP/ESP/AH/Any
- Source port range + Destination port range
- Action β Allow or Deny
Default rules (priorities 65000+) sit at the end:
AllowVNetInBound/AllowVNetOutBoundβ VNet-internal trafficAllowAzureLoadBalancerInBoundβ health probesAllowInternetOutBoundβ outbound to internet by defaultDenyAllInBound/DenyAllOutBoundβ final catch-all
Service tags β the maintainable way
Service tags represent groups of Microsoft-maintained IP prefixes. Common SC-500-relevant ones:
Internet,VirtualNetwork,AzureLoadBalancerAzureCloud/AzureCloud.<region>β all Azure datacentre IPs (in region)Storage/Storage.<region>β Azure Storage public endpoints (in region)Sql/Sql.<region>β Azure SQL endpointsAzureKeyVault.<region>AzureMonitor,AzureActiveDirectory,AzureFrontDoor.Backend
Using service tags means Microsoft maintains the underlying IP ranges; rules stay current automatically.
Application Security Groups (ASGs)
ASGs let NSG rules reference groups of NICs by name. Pattern:
- Create ASGs
web-tier,app-tier,db-tier. - Attach NICs to the right ASG (a NIC can belong to multiple ASGs).
- NSG rule: source =
web-tier, destination =app-tier, port = 443, action = Allow.
Two key constraints:
- All NICs referenced by an NSG rule via ASG must be in the same VNet as the NSG.
- ASGs do NOT span VNets (use AVNM security admin rules or hub-and-spoke + NSGs for cross-VNet rules).
Azure Virtual Network Manager (AVNM)
AVNM scales network governance across many VNets via three configuration types:
| Configuration | What it does |
|---|---|
| Connectivity | Hub-and-spoke topology (auto-creates hub VNet + spoke peerings) or mesh (any-to-any peering across the scope). Replaces manual peering at scale. |
| Security admin rules | Priority-enforced NSG-like rules applied to all VNets in scope. Intents: AlwaysAllow / Allow / Deny. AlwaysAllow + Deny intents take priority OVER NSG rules β central enforcement that NSGs cannot override. |
| Routing (preview/GA depending on region) | Centralised user-defined route management across many VNets. |
Security admin rules vs NSGs
This is the most-tested AVNM distinction on SC-500:
| Feature | NSG rule | AVNM Security Admin rule |
|---|---|---|
| Scope | Subnet or NIC, within one VNet | Multiple VNets defined by AVNM network groups |
| Priority over NSG | Lower-priority NSGs in chain compose normally | AlwaysAllow and Deny intents OVERRIDE NSG rules β central enforcement |
| Created by | Subnet/VNet owner β local control | Tenant network admin β central control |
| Use case | Local subnet hardening | Tenant-wide invariants ('always deny inbound 22 from Internet', 'always allow Azure Bastion to all RDP/SSH') |
The exam pattern: when the scenario describes tenant-wide invariants (block SSH from internet across ALL VNets, regardless of subnet-team-set NSGs), the answer is AVNM security admin rules with Deny intent. When the scenario describes subnet-specific allow lists, the answer is NSGs (optionally with ASGs).
Priority interaction: how AVNM and NSGs compose
When a packet hits a VNetβs subnet:
- AVNM Security Admin rules apply first. AlwaysAllow β pass through (no NSG evaluation). Deny β drop (NSG cannot override). Allow β fall through to NSG evaluation.
- NSG rules then evaluate normally β subnet NSG first, then NIC NSG.
This is the central-control mechanism: a Deny security admin rule cannot be bypassed by an NSG owner adding a permissive Allow rule. Conversely, an AlwaysAllow ensures a specific path (e.g. Azure Bastion subnets reaching RDP) can never be blocked by an over-zealous NSG configured by a junior admin.
Scenario: Asha builds tenant-wide segmentation at Aurora Health Service
Across 47 subscriptions and ~120 VNets, Asha needs:
- AVNM security admin rules at the tenant scope:
- Deny inbound from
Interneton TCP/22 and 3389 (SSH/RDP) β enforced across all VNets, no local-team override possible. - AlwaysAllow inbound from
AzureBastionsubnets β Bastion is the only sanctioned RDP/SSH path. - Deny inbound from
InternettoAzureKeyVaultservice tag destinations on VNet peripheries.
- Deny inbound from
- Hub-and-spoke connectivity via AVNM connectivity configuration β auto-creates and maintains peerings for new spokes added to the network group.
- Per-VNet NSGs with ASGs for application tier segmentation β
web-tierβapp-tieron 443;app-tierβdb-tieron 1433; everything else default-deny. - Service tag-based outbound rules β application subnets allowed outbound only to specific service tags (
AzureCloud.AustraliaEast,AzureKeyVault.AustraliaEast,Sql.AustraliaEast,Storage.AustraliaEast) β internet outbound denied by default.
Result: tenant-wide invariants enforced centrally; per-VNet teams retain local control; application traffic flows on labelled paths; outbound restricted to known Microsoft service ranges.
Key terms
Knowledge check
Asha at Aurora Health Service wants to ensure that inbound TCP/22 from the public internet is blocked across ALL 120 VNets in the tenant, regardless of any NSG rules that local subnet teams configure. Which capability fits?
Ravi at Maple Genomics has a 3-tier app β web NICs, app NICs, db NICs β within one VNet. He wants NSG rules that say 'web tier can talk to app tier on 443' without listing IP ranges that change with scale-out. Which feature fits?
Esme at Northwind Bank's network team wants to allow Azure VMs in a banking subnet to reach Azure Key Vault in the same Azure region β but only Azure Key Vault, not arbitrary internet destinations. Which NSG rule construction is cleanest?
Whatβs next
Next: Azure Virtual WAN security β secured virtual hubs, branch connectivity, and the security posture of a hub-and-spoke deployment at large scale.