Virtual Networks (VNets) and subnets
A VNet is your private network in Azure, scoped to one region and one subscription. It's divided into subnets, and every subnet must sit inside the VNet's address space with no overlap between subnets.
- Azure reserves 5 IP addresses in every subnet: network address, default gateway, two for Azure DNS mapping, and the broadcast address. So a /29 (8 addresses) leaves only 3 usable.
- Smallest subnet allowed is /29, largest VNet address space is /8 (RFC1918 or public, but public ranges owned by others can't be used).
- VNets can't be resized smaller than their existing subnets, and you can't shrink a VNet if it would drop below an existing subnet's range.
Peering
VNet peering connects two VNets so resources talk over the Microsoft backbone using private IPs - no public internet, no VPN gateway needed.
- Peering is non-transitive: if A peers with B, and B peers with C, A cannot reach C automatically.
- Global peering connects VNets across regions; local peering is same-region.
- Peered VNets must NOT have overlapping address spaces.
- Gateway transit lets a peered VNet use the other's VPN/ExpressRoute gateway instead of deploying its own.
Network Security Groups (NSGs)
NSGs filter traffic by 5-tuple rules (source, source port, destination, destination port, protocol) and apply at the subnet or NIC level.
- Rules have priority 100-4096; lower number = higher priority, and the first matching rule wins - no more evaluation after that.
- Default rules (priority 65000+) allow VNet-to-VNet traffic, allow Azure Load Balancer traffic, and deny all other inbound.
- Default rules can't be deleted but can be overridden by higher-priority custom rules.
- When both a subnet NSG and a NIC NSG apply, BOTH must allow the traffic for it to pass (inbound: subnet then NIC; outbound: NIC then subnet).
Routing
Azure creates System Routes automatically (VNet local, on-premises via gateway, 0.0.0.0/0 to internet). User-Defined Routes (UDRs) override these via a Route Table attached to a subnet, commonly used to force traffic through a Network Virtual Appliance (NVA) or firewall.
Private endpoints vs Service endpoints
- A Service Endpoint extends the VNet identity to a PaaS service over the Azure backbone but the PaaS resource keeps a public IP.
- A Private Endpoint gives the PaaS resource a private IP inside your VNet (via Private Link) - this is the more secure, exam-favoured answer for locking down storage/SQL/etc.
Common mistakes
- Forgetting NSG rules evaluate lowest-priority-number-first and stop at the first match.
- Assuming peering is transitive - it isn't, you'd need a hub-and-spoke with the hub relaying (or mesh peering).
- Trying to peer VNets with overlapping CIDR ranges - this always fails.
- Confusing Service Endpoint (still public IP) with Private Endpoint (private IP, uses Private Link).
How many IP addresses does Azure reserve in every subnet?
5 - network address, default gateway, two for Azure DNS, and broadcast.
tap to reveal
What is the smallest subnet size allowed in Azure?
/29 (8 addresses total, 3 usable after Azure's reservations).
tap to reveal
Is VNet peering transitive?
No. If A peers with B and B peers with C, A cannot reach C through B automatically.
tap to reveal
What happens if two VNets have overlapping address spaces and you try to peer them?
Peering fails - address spaces must not overlap.
tap to reveal
What priority range do NSG rules use, and which wins?
100 to 4096; the lowest number has highest priority and the first matching rule stops evaluation.
tap to reveal
Can you delete the default NSG rules?
No, but you can override them with custom rules at a higher priority (lower number).
tap to reveal
For inbound traffic to reach a VM, which NSGs must allow it?
Both the subnet NSG and the NIC NSG must allow the traffic.
tap to reveal
What overrides Azure's automatic System Routes?
User-Defined Routes (UDRs) added to a Route Table attached to a subnet.
tap to reveal
What is the key difference between a Service Endpoint and a Private Endpoint?
Service Endpoint keeps the PaaS resource's public IP; Private Endpoint gives it a private IP inside the VNet via Private Link.
tap to reveal
What does gateway transit allow in VNet peering?
A peered VNet can use the other VNet's VPN or ExpressRoute gateway instead of deploying its own.
tap to reveal
How many regions can a single VNet span?
One - a VNet is scoped to a single Azure region and subscription.
tap to reveal
What is the difference between global and local VNet peering?
Global peering connects VNets in different regions; local peering connects VNets in the same region.
tap to reveal
What is the maximum address space size for a VNet?
/8, using RFC1918 private ranges (or valid public ranges you own).
tap to reveal