Azure Networking Services
VNets, traffic routing and hybrid connectivity
VNets, subnets, NSGs, peering, Load Balancer and Application Gateway form Azure networking. VPN/ExpressRoute connect on-prem; Private Endpoint keeps traffic off the internet.
What you will learn
- Design VNets and subnets
- Apply NSGs for network security
- Route traffic with LB/App Gateway and connect on-prem
A VNet is your private address space; subnets carve it into zones; NSGs filter traffic per subnet/NIC; VPN/ExpressRoute connect on-premises; Load Balancer / Application Gateway route inbound traffic.
What is this?
Azure Virtual Network (VNet) is the foundation: a private IP space with subnets and default system routes. Network Security Groups (NSGs) are stateless-ish rule collections applied to subnets or NICs. Peering joins VNets (transitive via routing hubs), and virtual network gateways (VPN/ExpressRoute) connect on-prem networks. Azure Load Balancer (L4) distributes traffic; Application Gateway (L7) adds HTTP rules + WAF; Azure Front Door/CDN sits globally. Private Endpoint attaches a private IP to PaaS services so traffic never leaves Azure.
Why do you need it?
- VNet design is the blast radius: a bad subnet + NSG placement exposes services.
- On-prem hybrid is the common enterprise reality — ExpressRoute/VPN is table stakes.
- Private Endpoint removes internet egress for PaaS — a security and audit win.
- LB vs App Gateway: L4 for TCP/UDP scale, L7 for HTTP routing, WAF and path rules.
Mental model
A campus with roads, gates, and a mailroom
Azure networking
VNet is the campus; subnets are departments on separate roads; NSGs are gates per road/building; the load balancer is the reception desk distributing visitors; ExpressRoute is a private highway to downtown so you don't use public streets.
How it works
- VNet CIDR → subnets per tier/AZ; system routes keep traffic between subnets local.
- NSGs filter with priority-ordered rules (apply to subnet or NIC); they are not NACL-like stateless but still rule-based.
- Peering: two VNets peer for direct private traffic; a hub-and-spoke topology centralizes egress/inspection.
- VPN gateway/S2S or ExpressRoute (private circuit) connects on-prem; ExpressRoute avoids public internet.
- LB (L4) spreads TCP/UDP over a backend pool of NICs with health probes; App Gateway (L7) routes HTTP paths, terminates TLS, WAF.
- Private Endpoint gives PaaS (SQL, Storage) a private IP in your VNet; DNS resolves to it.
A hub-and-spoke Azure network.
In production
- An enterprise uses hub-spoke: spoke VNets per app, a central ExpressRoute hub, NSGs per subnet, and Front Door on top.
- A fintech puts all PaaS (SQL, Storage) behind Private Endpoints to keep the attack surface private.
- A gaming backend routes HTTP via Application Gateway with WAF in front of a VMSS across zones; TCP workloads via Load Balancer.
Best practices
- Plan VNets with non-overlapping CIDRs; overlapping ranges break peering/VPN.
- Apply NSGs at both subnet and NIC when semantics differ; avoid rule sprawl.
- Route east-west through the hub only where needed; peering is cheaper and simpler for clean, isolated spokes.
- Use Private Endpoint for PaaS access; reserve public exposure for genuine public services.
Common mistakes
- Reusing the same CIDR across subscriptions, then hitting peering conflicts.
- Implicit trust: no NSG on 'private' subnets, then an accidental public IP on a VM inside.
- Peering everything mesh-style, creating explosion of peer links and unpredictable routing.
- Forgetting NSG rules are state-aware in direction for ICMP/response flows.
Common issues
Can't reach a VM from the internet on port 443NSG inbound rule missing or priority issue
Add an Allow HTTPS rule in the NSG with correct priority; verify via network watcher effective rules.
Peered VNets can't talk despite peeringOverlapping address spaces or route bleed
Check both address spaces for overlap and the peering connection state.
ExpressRoute link is downCircuit/provider issue or gateway subnet misrouted
Check ExpressRoute circuit health in portal and the virtual network gateway/VPN devices.
Debugging tips
- Trace the path: VM to VM via network watcher IP flow verify shows NSG/route blocks.
- 'Denied by policy' for NSG → check Azure Policy network rules and effective NSG on the subnet/NIC.
- HB/LB probe failing? Verify the probe port/path and backend health.
- Peering route missing: check both peering routings and the address spaces.
Interview checkpoint
Hands-on lab
- Create two VNets in one region
- Peer the VNets successfully
- Add an NSG rule and verify effective rules
Build a VNet with NSGs and Peering
35 min · intermediate
Quick quiz
Which service attaches a private IP to PaaS so traffic never leaves Azure?