The order Azure applies subnet and NIC network security groups for inbound and outbound traffic, how priority works, and a worked example.
From Ultra Transcenders AZ-104 by Tony Rough
Once an NSG is associated, Azure evaluates its rules in a strict order. Most NSG troubleshooting comes down to working out which rule matches first.
Rules are processed in ascending priority order (lower number first); the first matching rule applies and processing stops. Custom priorities range from 100 to 4096, and the default rules sit at 65000-65500 (so 64999 isn’t a valid custom priority).
To allow traffic that is currently blocked, add an Allow rule with a lower priority number than the Deny rule. A Deny rule never makes traffic succeed. If an allow rule is already at 100, it can’t gain precedence, so the block must be somewhere else (another NSG or the rule’s criteria).
Worked examples:
Inbound traffic must be allowed by both the subnet NSG (evaluated first) and the NIC NSG.
NSGs are stateful: return traffic for an allowed flow is allowed automatically, so you don’t need a matching rule in the other direction.
For outbound traffic the order is reversed: the NIC NSG is evaluated first, then the subnet NSG. (See Figure 12.1.)
| Default rule | Priority | Effect |
|---|---|---|
| AllowVNetInBound | 65000 | Traffic within the VNet and peered VNets |
| AllowAzureLoadBalancerInBound | 65001 | Health probe traffic |
| DenyAllInBound | 65500 | Everything else, including internet |
| AllowVnetOutBound | 65000 | VM-initiated traffic to VNet/peered VNets |
| AllowInternetOutBound | 65001 | Outbound internet |
| DenyAllOutBound | 65500 | Everything else outbound |
You can’t delete the default rules, but custom rules with a higher priority (a lower number) override them.
This note is one section of Ultra Transcenders AZ-104: Microsoft Azure Administrator, an independent study guide that explains every topic the exam covers by technology, with comparison tables, diagrams and the common traps, plus a glossary linked to Microsoft Learn.
About the book · Free AZ-104 glossary · All AZ-104 study notes
Where LRS, ZRS, GRS, RA-GRS, GZRS and RA-GZRS keep your copies, what each survives, and which account types support them.
The three SAS types, what each can grant, how they're signed, and how to revoke one when a token leaks.
How the storage account firewall decides who gets in: IP rules, VNet rules with service endpoints, private endpoints and the trusted-services exception.
What a private endpoint puts in your subnet, how private DNS zones make names resolve to it, and when to choose it over a service endpoint.
Which App Service tiers allow manual scale-out, autoscale, slots and how many instances, and the difference between scaling up and scaling out.
Fault and update domains, zones, the SLA each gives, and what you can and can't change after a VM is created.
What delete and read-only locks block, how they inherit, and the surprising things a ReadOnly lock stops (like listing storage keys).