Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

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.

NSGASGRoute table
Question it answersAllow or deny?Which servers is this rule about?Where does the packet go next?
Attaches toSubnet and/or NICNICs join itSubnets (one table per subnet)
OrderPriority 100 to 4096, lowest wins; defaults at 65000+Not applicableLongest prefix; user route beats system on a tie
Troubleshoot withEffective security rules, IP flow verifyEffective security rulesEffective routes, next hop
PriceFreeFreeFree (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

3D Azure networking for admins: hub, spokes, routes, NSGs and load balancing Send three packets at two NSGs.

🖱️ Drag to rotate · scroll or pinch to zoom

Loading the 3D scene…
</> Embed

Embed this simulation

Free for trainers, teachers and bloggers. Paste this into your page:

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.

Read this tour as text
  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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

Install MSDEVBUILD Azure

Free · no account · works offline

Save the whole course for offline ›

Hi, I’m your Nimbus

Your study buddy. Pick what we do next.

MSDEVBUILD · Multi-Stack Dev Build

Sign in to MSDEVBUILD

One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.