All exams← All Azure Administrator (AZ-104) notes

Virtual networking configuration: Azure Administrator (AZ-104) revision notes

Revision notes

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).

Key facts

Flashcards

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
Practice questions

Virtual networking configuration: 5 practice questions

Q1. An administrator creates a virtual network with address space 10.10.0.0/16. What is the maximum number of usable host addresses across that entire address space, ignoring Azure's per-subnet reservations?
  • A.  65,534
  • B.  65,536
  • C.  32,768
  • D.  65,533
Show answer & explanation
✓ Answer: A. 65,534
A /16 network provides 2^16 = 65,536 total addresses, and standard IPv4 subnetting reserves the network and broadcast address, leaving 65,534 usable. Azure's five-address-per-subnet reservation is applied per subnet, not to the whole address space, so it is not subtracted here.
Q2. An engineer creates a subnet 10.0.1.0/24 in Azure. How many IP addresses does Azure reserve and make unavailable for VM use within that subnet?
  • A.  3
  • B.  5
  • C.  2
  • D.  1
Show answer & explanation
✓ Answer: B. 5
Azure reserves five addresses in every subnet: the network address, the default gateway, two addresses for Azure DNS mapping, and the broadcast address. This means a /24 subnet, which has 256 addresses, only offers 251 usable addresses for resources.
Q3. Two network security group rules apply to inbound traffic on the same subnet: one has priority 100 and denies traffic from a specific source, the other has priority 200 and allows the same traffic. Which rule takes effect?
  • A.  The allow rule at priority 200, because higher numbers win
  • B.  Both rules apply, with deny taking precedence regardless of priority
  • C.  Azure merges the rules and blocks only part of the traffic
  • D.  The deny rule at priority 100, because lower numbers are evaluated first and win
Show answer & explanation
✓ Answer: D. The deny rule at priority 100, because lower numbers are evaluated first and win
NSG rules are processed in order of priority number, with lower numbers evaluated first; once a rule matches, processing stops and no further rules are evaluated. Priority 100 is lower than priority 200, so the deny rule is evaluated first and blocks the traffic.
Q4. A newly created network security group has no custom rules added. Which statement correctly describes its default behaviour for inbound traffic from the internet?
  • A.  Inbound traffic is allowed only from Azure Load Balancer by default
  • B.  All inbound internet traffic is allowed by default until a deny rule is added
  • C.  All inbound internet traffic is denied by a default rule, while inbound traffic from within the virtual network is allowed
  • D.  All traffic, inbound and outbound, is denied until explicitly permitted
Show answer & explanation
✓ Answer: C. All inbound internet traffic is denied by a default rule, while inbound traffic from within the virtual network is allowed
Every NSG ships with default rules: inbound traffic from the internet is denied, inbound traffic from within the VNet is allowed, and inbound traffic from Azure Load Balancer is allowed. These defaults cannot be deleted, though they can be overridden by higher-priority custom rules.
Q5. A company wants a storage account to be reachable only from resources inside a specific subnet, without the storage account being assigned a private IP address in that VNet. Which feature satisfies this requirement?
  • A.  A NAT gateway
  • B.  An application security group
  • C.  A private endpoint
  • D.  A service endpoint
Show answer & explanation
✓ Answer: D. A service endpoint
A service endpoint extends the subnet's identity to the service, letting the storage account restrict access to that subnet's traffic while the service still uses its public IP and no NIC is created in the VNet. A private endpoint would instead give the storage account a private IP address inside the VNet, which is not what was asked for here.
Test yourself
See the Azure Administrator (AZ-104) page

More Azure Administrator (AZ-104) topics