Compare
NSG vs ASG vs Route Table
30-second answer
An NSG decides whether a flow is allowed or denied, attached to a subnet or NIC. An application security group is a label for NICs that NSG rules can target instead of IP addresses. A route table with user-defined routes decides where packets go next, attached to subnets.
Simulate it »Side by side
↔ Swipe the table to see every column.
| NSG | ASG | Route table | |
|---|---|---|---|
| Question it answers | Allow or deny? | Which servers is this rule about? | Where does the packet go next? |
| Attaches to | Subnet and/or NIC | NICs join it | Subnets (one table per subnet) |
| Order | Priority 100 to 4096, lowest wins; defaults at 65000+ | Not applicable | Longest prefix; user route beats system on a tie |
| Troubleshoot with | Effective security rules, IP flow verify | Effective security rules | Effective routes, next hop |
| Price | Free | Free | Free (the NVA is not) |
Prices are illustrative pay-as-you-go list prices converted at approximate rates, for "price feel" only. Check the Azure pricing calculator for real quotes.
Which one should I pick?
NSG
Pick it when you need to block or allow ports and sources
ASG
Pick it when rules should follow a role (web, db) rather than IP addresses
Route table
Pick it when traffic must go through a firewall or NVA, or be dropped
Simulate it
🖱️ Drag to rotate · scroll or pinch to zoom
NSGs, ASGs and effective rules
An NSG has rules checked by priority (100 to 4096, lowest first). Inbound traffic meets the subnet NSG first, then the NIC NSG, and both must allow. An application security group lets a rule say "to the web servers" instead of listing IPs.
🤔 What happens if…
Read this tour as text
- VNets, subnets and a public IP. A virtual network is your private range in one region, split into subnets. Azure keeps 5 addresses in every subnet. A Standard public IP is static, zone-redundant where the region has zones, and closed to inbound traffic until an NSG opens it.
- Peering is not transitive. VNet peering joins two VNets over the Microsoft backbone. Each side has its own link, address spaces can't overlap, and the hub can share its VPN gateway (gateway transit). Peering never chains: spoke 1 and spoke 2 can't talk through the hub on their own.
- User-defined routes to the NVA. A route table on a subnet overrides system routes. Next hop Virtual appliance sends traffic to a firewall or NVA, which needs IP forwarding on its NIC. Longest prefix wins, and a user route beats a system route on the same prefix.
- NSGs, ASGs and effective rules. An NSG has rules checked by priority (100 to 4096, lowest first). Inbound traffic meets the subnet NSG first, then the NIC NSG, and both must allow. An application security group lets a rule say "to the web servers" instead of listing IPs.
- Azure Bastion. Azure Bastion lives in AzureBastionSubnet (/26 or larger) and opens RDP and SSH to VMs on their private IPs, from the portal over TLS 443 or with the native client on Standard and Premium. One Bastion in the hub serves peered spokes.
- Service endpoint vs private endpoint. A service endpoint sends a subnet's traffic to the service's public IP over the backbone, and the service firewall allows that subnet. A private endpoint gives the service a private IP in your VNet, and a privatelink private DNS zone makes the name resolve to it.
- Azure DNS: public and private zones. A public zone answers the internet once you delegate the domain to Azure's name servers. Alias records point at Azure resources such as a public IP. A private zone answers only VNets with a virtual network link, and can auto-register VM names.
- Standard load balancer and health probes. A load balancer spreads TCP/UDP flows from a frontend (public or internal) to a backend pool by load-balancing rules. A health probe pulls a VM out of rotation when it stops answering. Probes come from 168.63.129.16.
- Troubleshoot with Network Watcher. Network Watcher tools answer one question each. IP flow verify: which NSG rule allows or denies this flow? Next hop: where does this packet go? Connection troubleshoot: can A reach B, and if not, at which hop?
Questions people ask
Are NSGs stateful?
Yes. If an inbound flow is allowed, its replies are allowed out automatically.
Can an ASG span VNets?
No. All NICs in an ASG, and ASGs used together in one rule, must be in the same virtual network.
Learn each one properly
More comparisons
- Owner vs Contributor vs Reader vs User Access Administrator
- Azure RBAC Roles vs Microsoft Entra Roles
- Storage Account Key vs SAS vs Microsoft Entra ID
- Blob Soft Delete vs Versioning vs Snapshots
- ARM JSON Templates vs Bicep Files
- Availability Set vs Availability Zones vs Flexible Scale Set
- Container Instances vs Container Apps vs App Service
- App Service scale up vs scale out
- Service Endpoint vs Private Endpoint
- Recovery Services Vault vs Backup Vault
- Azure Backup vs Azure Site Recovery