A VNet is your private network boundary in Azure. Nothing enters or leaves unless you explicitly allow it. Everything networking builds on VNets.
A Virtual Network is your private city in Azure. Everything inside the city is yours, private, isolated from other organisations, invisible to the public internet unless you explicitly open doors. When you create a VNet you define an address space, a range of IP addresses that exist within this city. Typically something like 10.40.0.0 slash 16, giving you 65,536 IP addresses. Subnets are the neighbourhoods within your city. You carve your address space into subnets. The web tier at 10.40.1.0 slash 24, the data tier at 10.40.2.0 slash 24, management at 10.40.3.0 slash 24. Resources in different subnets can communicate by default but you control that with Network Security Groups. CIDR notation: the slash number tells you how many bits are fixed. Slash 16 means 65,536 addresses. Slash 24 means 256 addresses. But Azure reserves 5 of those for internal use. The network address, the default gateway, two DNS addresses, and the broadcast address. So a slash 24 subnet gives you 251 usable IP addresses. That specific number, 251, appears on. the exam repeatedly. Special subnets have exact naming requirements. Bastion requires AzureBastionSubnet, exact case, no variations. Azure Firewall requires AzureFirewallSubnet. VPN and ExpressRoute require GatewaySubnet. These names are hardcoded requirements, not suggestions. Always use Standard SKU public IPs. They are static, zone-redundant, and secure by default. Basic SKU is being deprecated and is insecure by default because inbound connections are allowed from anywhere. VNets exist within one region. You cannot stretch a VNet across regions. To connect resources across regions, use VNet Peering. To connect to on-premises, use VPN Gateway or ExpressRoute, both requiring a GatewaySubnet inside your VNet. You can add address space to an existing VNet but cannot change an existing subnet's range if it has resources in it. Plan your subnets generously.. Remember: Slash 24 gives 251 usable IPs. Special subnets have exact names: AzureBastionSubnet, AzureFirewallSubnet, GatewaySubnet. Always use Standard SKU public IPs. VNet exists in one region.
📖 Virtual Networks — Complete Explanation
A Virtual Network (VNet) is Azure's implementation of a software-defined network. There is no physical hardware you manage — Azure's network fabric creates isolated, private network spaces entirely in software.
Address space: When you create a VNet, you define one or more CIDR ranges (e.g., 10.40.0.0/16). This is the universe of IP addresses available to resources in this VNet. Azure recommends using private address ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
Subnets divide the VNet address space into smaller segments. Each subnet gets its own CIDR block (e.g., 10.40.1.0/24 for web tier). Resources in the same subnet can communicate freely by default. Subnets are where you apply NSGs, route tables, and service endpoints.
Why subnet isolation matters: Put your web servers in one subnet, databases in another, management in a third. NSGs on the data subnet can say "only accept traffic from the web subnet" — even if someone compromises a web server, they cannot directly reach your database servers from the internet.
VNet scope: A VNet exists in exactly ONE region. You cannot stretch a VNet across regions. To connect resources across regions, you use VNet Peering. To connect to on-premises, you use VPN Gateway or ExpressRoute, both of which require a GatewaySubnet inside the VNet.
Kube context: Your Function Apps running in the Consumption plan cannot join a VNet — they need Premium plan for VNet Integration. Your VMs and Premium Function Apps sit in the Kube VNet, reaching Cosmos DB via a Private Endpoint in the pe-subnet, ensuring traffic never leaves your private network.
🏙️
The City Metaphor — Runs Through All of Phase 4
VNet = the city boundary. Your private space. Subnet = neighbourhoods inside (web tier, data tier, mgmt). NSG = traffic police at each neighbourhood checkpoint. Public IP = the city address visible to outside world. Peering = private road between two cities. UDR = custom road signs overriding GPS (Azure routing). DNS = the city phonebook. NAT Gateway = your post office with a consistent return address.
VNet Architecture — Kube platform Production Network
CIDR — Understanding Address Spaces
CIDR
Total IPs
Usable in Azure
Azure Use Case
/16
65,536
65,531
Standard VNet (recommended)
/24
256
251
Typical subnet — most tested
/27
32
27
Bastion subnet minimum
/26
64
59
Azure Firewall subnet minimum
/28
16
11
Small subnet, Gateway subnet minimum
⚠️
Overlapping Address Spaces Block Peering
Two VNets with the same or overlapping address space cannot be peered — Azure cannot route between them. Plan address spaces before deployment. Changing address space after resources exist is complex and risky.
Public IP — SKU Matters
Feature
Basic SKU
Standard SKU
Allocation
Dynamic or Static
Static only
Zone redundancy
✗
✓
Inbound default
Open (insecure)
Closed — need NSG to allow
Standard Load Balancer
✗ Incompatible
✓ Required
Status
Being deprecated
Always use Standard
⚠️
SKU Mismatch = Deployment Fails
Standard Load Balancer + Basic Public IP = deployment error. Standard Public IP + Basic Load Balancer = deployment error. Always match SKUs. Use Standard+Standard everywhere.
NSG = stateful rule-based filter attached to subnet or NIC. Contains inbound and outbound rules. First matching rule wins — evaluation stops.
Network Security Groups are Azure's traffic filtering layer. An NSG is a stateful packet inspector sitting at the boundary of a subnet or network interface. Stateful means if you allow an inbound connection, the return traffic is automatically allowed without needing an explicit outbound rule. Your NSG allows inbound HTTPS on port 443. When the VM responds, Azure knows this is return traffic for an allowed connection and lets it through automatically. NSG rules have a priority number. Lower number means higher priority. Each rule has a source, destination, protocol, port range, and action of allow or deny. First matching rule wins. Evaluation stops. Default rules are built into every NSG. 65000 AllowVnetInBound allows traffic between resources in the same VNet. 65001 AllowAzureLoadBalancerInBound allows health probe traffic. 65500 DenyAllInBound blocks everything else. Outbound defaults: 65000 allows VNet-to-VNet, 65001 allows internet outbound, 65500 denies everything else. Evaluation order. the exam tests constantly: for inbound traffic, the subnet NSG is evaluated first, then the NIC NSG. Both must allow the traffic. For outbound traffic, the NIC NSG is evaluated first, then the subnet NSG. Reversed order. This matters practically. If you add an allow rule to the subnet NSG for port 1433 but the NIC NSG has a deny rule for 1433, traffic is still blocked. Use Effective Security Rules in Network Watcher to see the combined result of all NSGs on a NIC. Classic production incident: all VMs show unhealthy behind a load balancer. The NSG looks fine for application traffic. The problem is health probe traffic comes from the AzureLoadBalancer service tag at IP 168.63.129.16. If your NSG does not allow this tag inbound on the probe port, probes fail and all VMs appear unhealthy. Application Security Groups let you tag VM NICs with a label instead of using IP addresses in rules. NSG rule says allow asg-web-servers to reach asg-db-servers on port 1433. Add a new VM, tag its NIC with the ASG, it is immediately covered. No IP management.. Remember: NSG is stateful, return traffic is automatic. Inbound: subnet first, NIC second. Outbound: NIC first, subnet second. Both must allow. AzureLoadBalancer tag must be allowed for health probes.
NSG Evaluation Order — Inbound: Subnet First, NIC Second · Outbound: NIC First, Subnet Second
Animated — Packet Flow: HTTPS from internet → VM through both NSGs
⚠️
LB Health Probes Blocked — Missing AzureLoadBalancer Tag
LB health probes originate from AzureLoadBalancer service tag (168.63.129.16). If your NSG blocks this, all VMs show unhealthy even when working fine. Fix: add inbound Allow rule for AzureLoadBalancer tag on probe port, with priority lower than any deny rules.
Application Security Groups (ASG)
🏷️
The Metaphor
Without ASG your NSG rule says: "Allow IPs 10.40.1.4, 10.40.1.5, 10.40.1.6 to reach port 1433." VMSS scales to 20 VMs → edit 20 IPs in every rule.
With ASG: tag each web-server NIC with asg-web-servers. Rule says "Allow asg-web-servers to reach asg-db-servers port 1433." New VM added to VMSS → tag its NIC → automatically covered. Zero rule changes.
📋
ASG Constraints
All VMs in an ASG must be in the same VNet. One NIC can belong to multiple ASGs. ASG must be in the same region as VMs. Cannot span VNets or regions.
Azure CLI — NSG with ASG Rules
# Create ASGsaz network asg create-gRG-Prod--nameasg-web-serversaz network asg create-gRG-Prod--nameasg-db-servers# Tag VM NIC with ASGaz network nic ip-config update \
-gRG-Prod--nic-nameweb-vm-nic--nameipconfig1 \
--application-security-groupsasg-web-servers# NSG rule using ASG names (not IPs)az network nsg rule create \
-gRG-Prod--nsg-namensg-prod \
--nameweb-to-db-sql--priority100 \
--source-asgsasg-web-servers \
--destination-asgsasg-db-servers \
--destination-port-ranges1433 \
--protocolTcp--accessAllow
Bastion provides browser-based RDP/SSH to VMs over HTTPS — no public IPs on VMs, no port 3389/22 exposed to internet.
Azure Bastion solves the problem of securely connecting to VMs without exposing RDP or SSH to the internet. The old approach: assign public IPs to VMs and open port 3389 or 22 in the NSG. This works but means those ports are exposed to the entire internet. Attackers scan for open RDP ports constantly. Within minutes of deploying a VM with port 3389 open, you will see authentication attempts in your logs. Azure Bastion is the secure alternative. You deploy one Bastion resource per VNet. Administrators connect through the Azure Portal using their browser over standard HTTPS on port 443. Bastion authenticates them using Entra ID credentials and Azure RBAC, then establishes the RDP or SSH connection to the target VM through the VNet's private network. The whole session runs as HTML5 in the browser. Result: VMs have no public IP addresses. Port 3389 and port 22 are never exposed to the internet. The only port needed is 443, the same port used for every website. Two exact requirements you must know for. the exam. The subnet must be named exactly AzureBastionSubnet with capital A, capital B, capital S. Not bastion-subnet. Not BastionSubnet. Exactly AzureBastionSubnet. Azure looks for this exact name. Deploy with any other name and deployment fails. The subnet must be slash 27 minimum, giving 32 IP addresses with 27 usable. Azure needs multiple IP addresses for Bastion's high availability. A slash 28 is not enough. Deployment fails. No other resources can share this subnet. The Bastion service itself needs a Standard SKU static public IP. Not Basic, not dynamic. Standard and static. Two SKUs for Bastion: Basic gives RDP and SSH connections only. Standard adds copy-paste between local machine and VM, file upload and download, connect by IP address, and reach VMs in peered VNets from one Bastion deployment.. Remember: Subnet name must be exactly AzureBastionSubnet, case-sensitive. Minimum slash 27. Standard SKU static public IP on Bastion itself. Standard Bastion SKU adds copy-paste and file transfer.
Azure Bastion — VMs Need No Public IP
Animated — Bastion Connection: Browser → VM, no RDP port exposed
Requirement
Value
Subnet name
AzureBastionSubnet — exact, case-sensitive
Subnet minimum size
/27 (32 IPs)
Public IP on Bastion itself
Standard SKU, Static
Other resources in subnet
✗ Not allowed — dedicated subnet
Basic SKU
RDP/SSH only — no copy/paste, no file transfer
Standard SKU
Copy/paste, file transfer, connect by IP, reach peered VNet VMs
⚠️
Two Most Tested Bastion Failures
1. Subnet named "bastion-subnet" or "BastionSubnet" → deployment fails. Must be exactly AzureBastionSubnet. 2. Subnet is /28 → deployment fails. Must be /27 minimum. Both are classic exam traps.
Peering connects two VNets over Microsoft's private backbone. Low latency, no VPN needed. But peering is NOT transitive and requires BOTH directions to be created.
VNet Peering connects two Azure Virtual Networks so their resources can communicate privately through Microsoft's backbone network, not the public internet. Traffic between peered VNets never leaves Microsoft's infrastructure. Low latency, high bandwidth, private. From a routing perspective, once peered, a VM in VNet-A and a VM in VNet-B communicate as if they were in the same network. Their private IP addresses are directly reachable. The most important thing about peering: it is NOT transitive. Three VNets, A, B, and C. You peer A with B. You peer B with C. Can A reach C? No. Even though B is connected to both, traffic cannot transit through B automatically. Azure does not route traffic through an intermediate VNet unless you explicitly configure it with User-Defined Routes and a virtual appliance like a firewall. The second critical fact: peering requires both directions. Create peering from VNet-A to VNet-B and you see status as Initiated. Traffic still does not flow. You must also create the peering from VNet-B to VNet-A. Only when both show Connected does traffic flow. This catches people constantly in production. Team A creates their side, announces it is done, wonders why connectivity is not working. Because Team B has not created their side. Hub-spoke architecture uses peering at scale. One VNet is the hub, containing shared services like VPN Gateway, Azure Firewall, and Bastion. All other VNets are spokes that peer to the hub. Without a hub, 10 VNets needing to connect to each other require 45 peering connections. With hub-spoke, you need only 10. Three peering settings for hub-spoke: Allow Gateway Transit on the hub lets spokes use the hub's VPN Gateway without each spoke having its own. Use Remote Gateways on the spoke tells it to use the hub's gateway. Allow Forwarded Traffic on both permits traffic that originated outside a VNet to pass through. Peering requires non-overlapping address spaces. Two VNets with the same range cannot be peered.. Remember: Peering is NOT transitive. Requires both directions, both must show Connected. Hub-spoke for shared services. Allow Gateway Transit on hub, Use Remote Gateways on spoke.
Peering: Both directions required · NOT transitive
Hub-Spoke Architecture — Shared Services Pattern
⚠️
Peering "Initiated" not "Connected" — Traffic Doesn't Flow
You created VNet-A → VNet-B peering. Status shows "Initiated". This is NOT connected. You must also create VNet-B → VNet-A peering. Only when BOTH show "Connected" does traffic flow. Think handshake — both parties must reach out.
📋
Three Peering Settings — Know Them All
Allow Gateway Transit (set on Hub): Hub shares its VPN Gateway. Spokes can reach on-prem without own gateway. Use Remote Gateways (set on Spoke): Spoke uses Hub's gateway. Requires Hub to have Allow Gateway Transit ON. Allow Forwarded Traffic (both): Traffic originating outside VNet is accepted. Required for spoke→hub→spoke routing.
Azure CLI — Peering Both Directions
# Direction 1: Dev → Prodaz network vnet peering create \
-gRG-Dev--nameDev-to-Prod \
--vnet-namevnet-dev \
--remote-vnet/subscriptions/PROD-SUB-ID/resourceGroups/RG-Prod/providers/Microsoft.Network/virtualNetworks/vnet-prod \
--allow-vnet-access--allow-forwarded-traffic# Direction 2: Prod → Dev (REQUIRED — without this status = "Initiated")az network vnet peering create \
-gRG-Prod--nameProd-to-Dev \
--vnet-namevnet-prod \
--remote-vnet/subscriptions/DEV-SUB-ID/resourceGroups/RG-Dev/providers/Microsoft.Network/virtualNetworks/vnet-dev \
--allow-vnet-access--allow-forwarded-traffic# Verify — both should show "Connected"az network vnet peering show-gRG-Dev--vnet-namevnet-dev \
--nameDev-to-Prod--querypeeringState
Azure routes traffic using system routes by default. UDRs override those defaults — forcing traffic through a specific next hop (firewall, NVA). Most specific route wins.
User-Defined Routes give you control over where Azure sends network traffic by overriding Azure's automatic routing decisions. By default Azure routes traffic automatically. VMs within the same VNet reach each other directly. Internet-bound traffic exits through the VNet's internet gateway. This works fine until you need all traffic to pass through a firewall first. That is where Route Tables come in. You create a Route Table resource, add routes, and associate it with a subnet. Each route has a destination address prefix and a next hop. Your firewall route table might have destination 0.0.0.0 slash 0, meaning everything, with next hop Virtual Appliance at 10.0.1.4, your firewall's private IP. That single route forces all traffic from VMs in that subnet through the firewall first. The most important routing rule: longest prefix match. If a packet matches multiple routes, Azure uses the most specific one, the route with the longest prefix. A route for 10.40.0.0 slash 16 is less specific than a route for 10.40.1.0 slash 24. If a packet is going to 10.40.1.5, the slash 24 route wins. Next hop types: Virtual Appliance means a specific IP, your firewall. VirtualNetworkGateway sends to your VPN or ExpressRoute gateway. VirtualNetwork keeps traffic within the VNet. Internet sends out to the public internet. None is a black hole, traffic silently dropped. The critical gotcha on. the exam: creating a Route Table and adding routes does absolutely nothing until you associate the Route Table with a subnet. The routes sit idle until associated. When troubleshooting a UDR that is not working, first check: is the route table associated to the correct subnet? Use Network Watcher's Next Hop feature to verify routing. Input a source VM and destination IP. Next Hop tells you where Azure will actually route that packet. If it says Internet when you expect VirtualAppliance, your UDR is not applied.. Remember: Route Table must be associated to a subnet, creating routes alone does nothing. Longest prefix match wins. None is a black hole. Use Network Watcher Next Hop to verify routing.
🗺️
The Metaphor
Azure's default routing = car GPS picking fastest route. UDR = custom road signs overriding GPS. "All traffic to 10.40.0.0/16? Ignore GPS — go via the security checkpoint (Firewall) first." The packet must follow the road signs regardless of what the GPS says. Most specific sign wins — /16 sign beats /8 sign for a /24 destination.
Route Table — Most Specific Prefix Wins (Longest Prefix Match)
Animated — UDR in action: VM traffic forced through Azure Firewall
⚠️
Route Table Must Be ASSOCIATED to Subnet — Creating It Is Not Enough
Creating a Route Table and adding routes does nothing until you associate it to a subnet. Portal: Route Table → Subnets → Associate. CLI: az network vnet subnet update --route-table. Forgetting the association is the #1 UDR exam mistake.
Azure CLI — Route Table + Associate to Subnet
# Create route tableaz network route-table create-gRG-Prod--namert-spoke-web# Add route: all internet → Firewallaz network route-table route create \
-gRG-Prod--route-table-namert-spoke-web \
--namedefault-to-fw \
--address-prefix0.0.0.0/0 \
--next-hop-typeVirtualAppliance \
--next-hop-ip-address10.0.1.4# ASSOCIATE to subnet (required — without this nothing works)az network vnet subnet update \
-gRG-Prod--vnet-namevnet-prod \
--nameweb-subnet \
--route-tablert-spoke-web
Two ways to connect to Azure PaaS services (Storage, Cosmos, SQL) without traffic going over public internet. Very different in how they work.
Service Endpoints and Private Endpoints both help you access Azure PaaS services more securely, but they work completely differently. By default, your VM talking to Azure Storage takes a public internet path even though both are in Azure. Service Endpoints fix the routing. Enable a Service Endpoint for Microsoft.Storage on a subnet, and traffic from VMs in that subnet to Storage takes Microsoft's private backbone instead of the public internet. It is a routing change. The destination is still a public IP address but the path is private. Service Endpoints require exactly two steps. Step one: enable the endpoint type on the subnet. Step two: add a Virtual Network rule in the storage account's firewall settings. Miss either step and it does not work. Service Endpoints are free, easy to configure, and work for traffic originating from within Azure VNets. Limitation: they do not work for on-premises access. Private Endpoints are fundamentally different. Instead of a routing change, a Private Endpoint gives the PaaS service a private IP address inside your VNet. Your storage account gets a network interface with a private IP in your subnet. Traffic stays entirely within your VNet. You can disable the public endpoint entirely. Private Endpoints also work for on-premises access through VPN or ExpressRoute. But Private Endpoints have a critical dependency that is easy to miss: DNS. After creating a Private Endpoint, DNS still returns the public IP for the service. Your VM resolves the storage hostname and gets the public IP. Traffic tries to go to the public endpoint, bypassing your Private Endpoint entirely. The fix: create a Private DNS Zone for the service. For Blob storage that is privatelink.blob.core.windows.net. Add an A record mapping the hostname to its private IP. Link this zone to your VNet. Now VMs resolve to the private IP and traffic goes through the Private Endpoint. If you tick Integrate with private DNS zone when creating the Private Endpoint in the portal, Azure handles this automatically. In automation, it is a separate step easy to forget.. Remember: Service Endpoint is a routing change, free, Azure-only. Private Endpoint gives PaaS a private IP in your VNet, works for on-premises too. Private Endpoint requires Private DNS Zone linked to VNet for correct name resolution.
🔌
The Metaphor
Service Endpoint = a dedicated lane on the highway. Your traffic stays on Microsoft's road (backbone) instead of the public internet. But the destination (Storage) still has a public address — you just got a faster private-ish route to it.
Private Endpoint = the destination moves into your house. Storage gets a private IP address inside your VNet. No public address involved at all. Traffic never leaves your network.
Service Endpoint vs Private Endpoint — Traffic Path Comparison
⚠️
Private Endpoint Needs Private DNS Zone — Easy to Miss
After creating a Private Endpoint for Storage, your VM resolves kubestg.blob.core.windows.net → still gets the public IP. Traffic goes over internet — private endpoint ignored.
Fix: Create Private DNS Zone (privatelink.blob.core.windows.net) → link to VNet → add A record pointing to private IP (10.40.6.11). Now DNS resolves to private IP → traffic stays in VNet.
Portal does this automatically if you tick "Integrate with private DNS zone" at creation time.
📊 Service & Private Endpoints — was this clear?✓ Saved
Azure DNS handles two scenarios: Public DNS (internet-facing) and Private DNS (internal name resolution within VNets).
Azure DNS has two distinct modes: public zones for internet-facing name resolution and private zones for internal VNet name resolution. Public DNS Zones host the DNS records of your internet-facing domains. If you own kubemind.in, create a public DNS zone in Azure, transfer name server authority to Azure's DNS servers, and manage all records from Azure. Record types you need to know: A records map hostname to IPv4 address. CNAME records create an alias, one hostname pointing to another hostname. MX records direct email. TXT records store verification text. NS records delegate to nameservers.. The exam gotcha: you cannot create a CNAME record for the apex domain, also called the root or naked domain. The apex is yourcompany.com with no prefix. CNAME requires pointing to another hostname but DNS specifications say the apex must be an A or NS record. So if you want kubemind.in pointing to Azure Traffic Manager or Front Door, a CNAME does not work. The solution is Azure DNS Alias Records, an Azure-specific extension. An Alias record at the apex points directly to an Azure resource like Traffic Manager, Front Door, or a public IP. Azure resolves the current IP of that resource dynamically. As the resource IP changes, the alias automatically updates. Private DNS Zones are for internal name resolution within VNets. Create a zone like kube.internal, add A records for VMs and services, and link the zone to VNets. VMs in linked VNets resolve these internal names without them being visible on the internet. Most common use for Private DNS Zones: Private Endpoints. After creating a Private Endpoint for Cosmos DB, DNS still returns the public IP without a Private DNS Zone. Create a zone for privatelink.documents.azure.com, add an A record mapping the hostname to the private IP, link the zone to your VNet. Now VMs resolve to the private IP and traffic goes through the Private Endpoint. Linking with auto-registration means every VM that starts automatically gets a DNS A record.. Remember: CNAME cannot be at the apex domain, use Alias records instead. Private DNS Zone must be linked to VNet for Private Endpoint resolution to work.
Public DNS Zone
Internet-Facing Name Resolution
Hosts DNS records for a domain (e.g. kubemind.in) so internet clients can resolve it.
Azure DNS becomes your authoritative nameserver — you delegate from your domain registrar to Azure's nameservers (ns1-xx.azure-dns.com).
Cannot use for apex domain CNAME: root domain (@ or kubemind.in) cannot have a CNAME — must use A record or Azure DNS alias record.
Private DNS Zone
Internal VNet Name Resolution
Resolves internal names (vm01.kube.internal) within your VNets only — invisible from internet.
Must link zone to VNet — without the link, VNet VMs cannot query the zone.
Auto-registration: link with auto-registration ON → VMs automatically get A records when they start. No manual management needed.
Used for: Private Endpoint DNS resolution, internal service discovery.
Record Type
Maps
Exam Notes
A
hostname → IPv4
Most common — VMs, web apps, private endpoints
AAAA
hostname → IPv6
IPv6 equivalent of A record
CNAME
alias → another hostname
Cannot use for apex/root domain
MX
domain → mail server
Required for email routing
TXT
domain → arbitrary text
Domain verification (Azure, Google, etc.)
NS
zone → nameservers
Delegation records — do not edit
PTR
IP → hostname (reverse)
Reverse DNS lookups
Alias (Azure-specific)
Apex → Azure resource
Solves CNAME at apex — points to Traffic Manager, Front Door, etc.
Animated — Private DNS Resolution: VM → Private Endpoint
⚠️
CNAME Cannot Be Used for Root/Apex Domain
You cannot create a CNAME record for kubemind.in (apex/root). CNAME requires another hostname as the target, but apex records must be A or NS records per DNS spec. Solution: use Azure DNS Alias record which can point the apex to Azure Traffic Manager, Front Door, or a public IP resource.
Azure has four load balancing services. Choosing the right one is a key exam scenario — each operates at a different layer for a different purpose.
Azure has four load balancing services and. the exam will present scenarios asking which one to choose. The decision comes down to: is this HTTP traffic or non-HTTP traffic, and is this regional or global? Azure Load Balancer operates at Layer 4, the transport layer, TCP and UDP. It distributes connections across backend VMs using a hash of source IP, source port, destination IP, destination port, and protocol. Fast, simple, the right choice for anything that is not HTTP. SQL Server connections, RDP, LDAP, custom TCP protocols. Application Gateway operates at Layer 7, the HTTP application layer. It reads the actual content of HTTP requests. It can route based on URL path, sending requests to slash api to one set of servers and slash images to another. It can route based on hostname. It does SSL termination, handling HTTPS decryption so backend servers only see plain HTTP. It has a built-in Web Application Firewall protecting against SQL injection and cross-site scripting. Application Gateway is regional, living in one Azure region. Azure Front Door is Application Gateway's global cousin. Same Layer 7 HTTP capabilities, URL routing, SSL, WAF, but operating globally across Microsoft's edge network. It uses anycast routing, meaning users connect to the nearest Front Door point of presence worldwide. Front Door also has CDN capabilities, caching static content at the edge. If your application serves users in India, the US, and Europe, Front Door routes each user to the nearest healthy backend automatically. Traffic Manager is DNS-based load balancing. It does not touch your actual traffic at all. It answers DNS queries and returns the IP address of the appropriate backend based on routing policies. Performance routing sends users to the lowest latency backend. Priority routing fails over to secondary when primary is unhealthy. Geographic routing sends users from specific countries to specific backends. No SSL offload, no URL routing, no WAF. Just DNS answers. Decision framework: non-HTTP traffic like SQL or RDP use Azure Load Balancer. HTTP with URL routing and WAF in one region use Application Gateway. HTTP with global users and CDN use Azure Front Door. DNS-based failover between regions use Traffic Manager. Standard Load Balancer requires Standard SKU public IP.. Remember: LB is Layer 4, App Gateway is Layer 7 regional, Front Door is Layer 7 global, Traffic Manager is DNS-based.
Service
Layer
Scope
HTTP/S features
Best For
Azure Load Balancer
Layer 4 (TCP/UDP)
Regional
✗
VMs, VMSS — raw TCP/UDP distribution
Application Gateway
Layer 7 (HTTP/S)
Regional
✓ WAF, SSL offload, URL routing
Web apps — route /api vs /images to different backends
Animated — LB Layer 4 vs AppGW Layer 7 traffic distribution
📋
Decision Tree — Which Load Balancer?
"Non-HTTP traffic (SQL, RDP, custom TCP)" → Azure Load Balancer
"HTTP/S, URL-based routing, WAF, within one region" → Application Gateway
"Global, users in multiple continents, CDN" → Front Door
"DNS failover between regions, no SSL involvement" → Traffic Manager
Azure Load Balancer — Deep Dive
Public Load Balancer
Internet → Internal VMs
Has a public IP frontend. Internet traffic hits the public IP → distributed across backend pool of VMs.
Components:
Frontend IP: public IP address (Standard SKU)
Backend pool: VMs or VMSS instances
Health probe: HTTP/TCP check on backend VMs
Load balancing rule: frontend port → backend port
Inbound NAT rule: specific external port → specific VM
Internal (Private) Load Balancer
Internal Traffic Only
Has a private IP frontend. Traffic from within VNet distributed to backend pool.
NAT Gateway gives all VMs in a subnet a consistent, static outbound public IP — without needing a public IP on each VM. Outbound only.
NAT Gateway solves the outbound connectivity problem. Many VMs needing to reach the internet with a predictable consistent public IP address. By default when a VM makes an outbound internet request, Azure assigns it a source IP from a shared pool. The IP is unpredictable and shared with other customers. If your application calls an external API that only accepts traffic from specific IPs, you cannot whitelist anything. If Azure exhausts shared SNAT ports under load, your connections get dropped silently. NAT Gateway fixes this. Create one NAT Gateway, assign it a public IP, and associate it with one or more subnets. Every VM in those subnets now makes outbound connections appearing to come from that NAT Gateway's public IP. Consistent, predictable, exclusively yours. The post office metaphor: without NAT Gateway, each VM writes its own return address on outbound mail and Azure might change those addresses. With NAT Gateway, there is one post office with one fixed address. All outbound mail goes out from the post office. Responses come back to the post office which routes them to the right VM internally. Practical benefits: external APIs whitelist one IP instead of tracking unpredictable dynamic IPs. You get consistent SNAT port availability, 64,000 ports per public IP, and you can attach up to 16 public IPs. For high-volume outbound scenarios like IoT telemetry senders, this eliminates SNAT exhaustion. Priority hierarchy for outbound connectivity that. the exam tests: if a VM has its own instance-level public IP, that IP is used directly and NAT Gateway is bypassed. If the VM's load balancer has outbound rules, those override NAT Gateway. If neither applies, NAT Gateway handles outbound. If nothing exists, Azure uses default SNAT from the shared pool. NAT Gateway cannot do inbound connections. NAT Gateway is strictly outbound only. For inbound you need a load balancer, a public IP on the VM, or Application Gateway.. Remember: NAT Gateway provides consistent outbound IP for all subnet VMs. Outbound only, no inbound. Priority: instance PIP, then LB outbound rule, then NAT Gateway, then default SNAT. Associate to subnet.
📬
The Metaphor
Without NAT Gateway: each VM has its own return address. 100 VMs = 100 different IPs visible to external services. Whitelisting is a nightmare.
With NAT Gateway: all 100 VMs share one post office with one return address. External APIs whitelist one IP. NAT Gateway handles translating "which VM sent this?" internally. Mail goes out from one known address, responses come back to the right VM.
NAT Gateway — Consistent Outbound IP for All Subnet VMs
Animated — NAT Gateway Outbound: All VMs share one consistent public IP
📋
NAT Gateway Priority — Who Wins?
If VM has instance-level Public IP → that IP is used for outbound (NAT bypassed).
If LB has outbound rule → LB frontend IP used (NAT bypassed).
If NAT Gateway assigned to subnet → NAT Gateway IP used.
If nothing → Azure assigns dynamic SNAT from shared pool (unpredictable, avoid in production).
Priority: Instance Public IP > LB Outbound Rule > NAT Gateway > Default SNAT
Network Watcher is your diagnostic toolkit for Azure networking. Troubleshoot connectivity, view routing decisions, capture packets, and audit flow logs.
Azure Network Watcher is your diagnostic toolkit for Azure networking. Think of it as the debugger for your network, the equivalent of opening DevTools in a browser but for packet flows, routing decisions, and security rule evaluations. Without Network Watcher, when something is not connecting, you are guessing. With it, you get precise answers in seconds. Let me walk through the tools you need to know. IP Flow Verify answers one question: is a specific packet allowed or blocked by NSG rules? You specify a source IP, source port, destination IP, destination port, and protocol. Azure evaluates all NSGs on the path and tells you Allow or Deny and the exact rule name responsible. This is the tool when you suspect an NSG is blocking traffic. Next Hop answers a different question: where will Azure actually route a packet from this VM to this destination? It tells you the next hop type and IP. If you have a User-Defined Route sending traffic to a firewall, Next Hop confirms the UDR is working. If it says Internet when you expected VirtualAppliance, your route table is not associated to the subnet. Connection Troubleshoot tests actual end-to-end connectivity between two endpoints on a specific port and protocol. It simulates the connection and tells you if it succeeds or fails, and why. Effective Security Rules shows you the combined result of all NSGs applied to a specific NIC. Instead of opening each NSG separately, this one view merges subnet NSG and NIC NSG rules in priority order. NSG Flow Logs capture every allowed and denied flow through an NSG, written to a storage account. Essential for security investigations and compliance auditing. Packet Capture captures actual network traffic from a VM and saves it as a pcap file. Wireshark for your cloud VMs without installing anything on the VM.. The exam asks you to distinguish between IP Flow Verify and Next Hop. IP Flow Verify is for NSG diagnosis. Next Hop is for routing diagnosis.. Remember that and you will answer any Network Watcher scenario correctly.
Tool
What It Does
When to Use
IP Flow Verify
Checks if NSG allows or blocks a specific packet (src IP/port → dst IP/port)
"My VM can't reach port 443 — which NSG rule is blocking it?"
Effective Security Rules
Shows combined NSG rules applied to a NIC (subnet NSG + NIC NSG merged)
"What rules are actually active on this VM's NIC?"
Next Hop
Shows where Azure will route a packet from a VM to a destination IP
"Is my UDR working? Is traffic going to Firewall or directly?"
Connection Troubleshoot
Tests end-to-end connectivity between two endpoints (TCP/ICMP)
"Can VM-A reach VM-B on port 1433?"
NSG Flow Logs
Logs every allowed/denied flow through NSG to Storage Account
Captures VM network traffic to a file (like Wireshark remotely)
Deep packet inspection, debugging application protocols
VPN Diagnostics
Diagnoses VPN Gateway connectivity issues
"Site-to-site VPN not connecting — what's failing?"
📋
IP Flow Verify vs Next Hop — Know Which Tool
IP Flow Verify: "Is this specific connection blocked by NSG?" → tells you ALLOW or DENY and which rule. Next Hop: "Where will traffic go from this VM to that destination?" → tells you the next hop type and IP (useful for UDR debugging).
Exam pattern: "VM can't reach external API despite NSG looking correct" → use Next Hop to check if UDR is sending traffic to wrong place.
Click to reveal. Networking is the most tested phase in AZ-104.
QA subnet /24 has 256 addresses. How many are usable for VMs?
ANSWER
251 usable addresses.
Azure reserves 5 IPs: .0 (network), .1 (default gateway), .2 (DNS), .3 (future use), .255 (broadcast). 256 - 5 = 251 usable for VMs and other resources.
QA VM can reach other VMs in its subnet but cannot reach a VM in a peered VNet. What are the two most likely causes?
ANSWER
1. Peering is "Initiated" but not "Connected" — only one direction was created. 2. NSG on the destination VM's subnet or NIC is blocking the traffic.
Check peering status first (both must show Connected). Then use IP Flow Verify to test if NSG is blocking. Check that Allow Forwarded Traffic is enabled if routing through a hub.
QAzure Bastion deployment fails with "subnet not found." The subnet is named AzurebasionSubnet with /27. What is wrong?
ANSWER
Typo in subnet name. Must be exactly "AzureBastionSubnet" — case-sensitive, no typos.
"AzurebasionSubnet" has a lowercase 'b' and missing 't' — Azure won't find it. Create a new subnet with the exact correct name: AzureBastionSubnet.⚠️ The /27 size is correct — that part is fine. The name is the issue here.
QA Function App on a VNet subnet cannot resolve the private DNS name for a Cosmos DB private endpoint. What is missing?
ANSWER
The Private DNS Zone (privatelink.documents.azure.com) is not linked to the VNet.
Private endpoint creates the DNS A record in the Private DNS Zone. But the VNet only queries zones that are linked to it. Without the link, the VNet uses public DNS → resolves to public IP → bypasses private endpoint entirely.
Fix: Private DNS Zone → Virtual Network Links → Add link to the VNet. Enable auto-registration optionally.
QAll VMs behind an Azure Standard Load Balancer show "unhealthy" in the backend pool. NSG and VMs look fine. What is the most likely cause?
ANSWER
NSG is blocking health probe traffic from the AzureLoadBalancer service tag.
LB health probes originate from 168.63.129.16 using the AzureLoadBalancer service tag. If NSG doesn't allow inbound from this tag on the probe port, probes fail → VMs show unhealthy → traffic stops being distributed.
Fix: Add NSG inbound allow rule — Source: AzureLoadBalancer, Destination: Any, Port: (your health probe port), Priority: lower than any deny rules.
QA UDR is created and routes added but traffic still goes directly to the internet instead of through the Firewall. What is most likely wrong?
ANSWER
The Route Table is not associated to the subnet.
Creating a Route Table and adding routes does nothing until it's associated to a subnet. Portal: Route Table → Subnets → + Associate. CLI: az network vnet subnet update --route-table.
Use Network Watcher → Next Hop to confirm where traffic is going and verify the UDR is applied.
QWhich tool would you use to identify: (a) which NSG rule is blocking port 1433, (b) whether traffic from VM-A to VM-B is being sent to the Firewall or directly?
ANSWER
(a) IP Flow Verify — tells you ALLOW or DENY and the exact rule name responsible. (b) Next Hop — shows the next hop type (VirtualAppliance = going to Firewall, or Internet = going direct).
IP Flow Verify = NSG diagnostic. Next Hop = routing diagnostic. Two different tools for two different problems.
Phase 4 — Cheat Sheet
/24 subnet usable IPs251 (256 minus 5 Azure reserved)
Bastion subnet name (exact)AzureBastionSubnet · minimum /27
Bastion Public IP SKUStandard Static
NSG inbound evaluation orderSubnet NSG first, NIC NSG second
NSG outbound evaluation orderNIC NSG first, Subnet NSG second
LB health probes blockedAdd NSG rule: Allow AzureLoadBalancer tag inbound
Peering status "Initiated"Only one direction created — create the return peering too
Peering is NOTTransitive — A↔B + B↔C ≠ A can reach C
UDR not working despite routesRoute Table not associated to subnet
Service Endpoint vs Private EndpointSE = MS backbone route. PE = private IP in VNet
Private Endpoint DNS not resolvingPrivate DNS Zone not linked to VNet
CNAME at apex/root domainNot allowed — use Azure DNS Alias record
Which NSG rule blocking traffic?Network Watcher → IP Flow Verify
Is UDR sending to Firewall?Network Watcher → Next Hop