Lesson 16 — VNet Peering, Service Endpoints & Private Endpoints
Why You Need to Understand This
No workload lives in complete isolation. Applications need to communicate across VNets. Databases and storage accounts need to be reachable from VMs without exposing them to the internet. These connectivity patterns — peering, service endpoints, and private endpoints — are among the most commonly tested AZ-104 topics, and they are also the most common sources of real-world misconfiguration in production Azure environments.
The concepts in this lesson are deceptively simple to state but require careful reasoning to apply correctly. VNet peering's non-transitivity trips up experienced engineers. Private endpoint DNS is a surprisingly deep topic. Pay close attention to the details — they are what distinguish a correct exam answer from a plausible-sounding wrong one.
VNet Peering
VNet Peering connects two VNets so their resources can communicate using private IP addresses over the Azure backbone network — never over the public internet. Traffic between peered VNets stays within Microsoft's network, providing low latency and high bandwidth.
Regional vs Global peering
| Type | Scope | Latency | Cost |
|---|---|---|---|
| Regional peering | Both VNets in the same Azure region | Sub-millisecond (same DC fabric) | Per-GB data transfer (low) |
| Global peering | VNets in different Azure regions | Higher (cross-region backbone) | Per-GB data transfer (higher than regional) |
Critical peering properties
- Peering is bidirectional but must be configured in both directions: when you create a peering from VNet A to VNet B, you must also create a peering from VNet B to VNet A. Creating only one direction means VNet A can reach VNet B, but VNet B cannot reach VNet A. The portal can create both sides simultaneously as a convenience.
- Address spaces cannot overlap: peered VNets must have non-overlapping CIDR ranges. Azure refuses to create the peering if they overlap.
- Peering is not inheritable: resources in peered VNets can only access each other's immediate peers. A VNet cannot access resources through a peer's other peers.
Non-Transitive Peering — The Most Important Peering Fact
VNet peering is non-transitive. This is the most tested and most misunderstood property of peering.
To allow A↔C communication, you have two options:
- Create a direct A↔C peering — simple but does not scale; in a large spoke topology you'd need O(n²) peerings.
- Route A→C traffic through an NVA (Azure Firewall) in VNet B — using UDRs in VNet A and VNet C that point to the Firewall in VNet B. This is the hub-spoke pattern and scales to any number of spokes.
Peering Configuration Properties
Each peering link has settings that control how traffic behaves. These are configured independently on each side of the peering.
| Setting | Where configured | Effect |
|---|---|---|
| Allow Virtual Network Access | Both sides | Enables IP communication between resources in the peered VNets. Default: on. Turning this off makes the peering configuration exist but no traffic flows. |
| Allow Forwarded Traffic | Both sides | Allows traffic that was forwarded through this VNet (i.e. originated elsewhere) to pass. Required in NVA/hub scenarios where the hub's Firewall forwards spoke-to-spoke traffic. |
| Allow Gateway Transit | Hub side (the VNet that has the gateway) | Permits the peered VNet to use this VNet's VPN Gateway or ExpressRoute Gateway for on-premises connectivity. Must be enabled on the hub for spoke gateway transit to work. |
| Use Remote Gateways | Spoke side (the VNet that will use the gateway) | Tells the spoke to use the gateway in the peered (hub) VNet. Requires Allow Gateway Transit to be enabled on the hub side. Cannot be enabled if the spoke already has its own gateway. |
Hub-Spoke Topology
The hub-spoke topology is the dominant enterprise network architecture in Azure. It uses peering to create a centrally-managed connectivity hub that shared services (firewall, VPN, DNS) live in, while application workloads live in isolated spoke VNets.
Key design rules for hub-spoke
- Spoke VNets peer to the hub — they do not peer with each other directly.
- Spoke-to-spoke traffic is routed through the Azure Firewall in the hub, providing centralised inspection and logging.
- UDRs in each spoke point 0.0.0.0/0 (and spoke CIDR ranges) to the Azure Firewall's private IP in the hub.
- Hub has Allow Gateway Transit enabled; spokes have Use Remote Gateways enabled to share the hub's VPN/ExpressRoute gateway.
- DNS: either an Azure DNS Private Resolver in the hub or DNS forwarder VMs — spoke VMs use this for hybrid DNS.
Service Endpoints
Service endpoints extend your VNet's identity to an Azure PaaS service. When enabled on a subnet for a specific service (e.g. Microsoft.Storage), traffic from that subnet to the service is routed through the Azure backbone instead of the internet — and the service sees the traffic's source as your VNet private IP range rather than a public IP.
How service endpoints work
- Enable the service endpoint on the subnet (e.g.
Microsoft.Storageon the AppTier subnet). - On the PaaS service (e.g. Storage Account), configure the firewall to allow traffic from that specific subnet/VNet.
- Azure adds a more-specific route to the subnet's routing table directing traffic for the service's IP ranges through the Azure backbone instead of the default internet gateway.
- The PaaS service uses the source VNet identity for access control — the storage account can allow only the specified VNet subnet and block everything else (including other Azure services and the internet).
Private Endpoints
A Private Endpoint creates a network interface with a private IP address from your VNet's address space that maps to a specific PaaS service instance. Traffic to that PaaS service goes entirely over the private network — it never touches the public internet or the service's public IP.
How private endpoints work
- Create a private endpoint resource, specifying the target PaaS resource (e.g. a specific Storage Account) and the sub-resource type (e.g.
blob). - Azure provisions a NIC in your chosen subnet with a private IP from that subnet's address space (e.g. 10.20.3.5).
- All traffic from your VNet to that Storage Account is routed to 10.20.3.5 — it stays entirely within the private network.
- Optionally disable public access on the Storage Account — now even internet callers cannot reach it.
mystorageaccount.blob.core.windows.net. Without DNS configuration, this name resolves to the Storage Account's public IP (e.g. 52.x.x.x) — traffic bypasses the private endpoint and goes to the internet. With correct DNS configuration, the same name resolves to your private endpoint IP (e.g. 10.20.3.5) — traffic stays private. The private endpoint exists but does nothing useful until DNS is correctly configured. This is the single most commonly missed step in private endpoint deployments.
Private DNS Zone configuration
The recommended approach for private endpoint DNS is to use Azure Private DNS Zones:
- Create a Private DNS Zone named
privatelink.blob.core.windows.net(the zone name depends on the service — each has a specific privatelink subdomain). - Link the Private DNS Zone to every VNet that needs to resolve the private endpoint.
- When you create the private endpoint, enable "Integrate with private DNS zone" — Azure automatically creates an A record in the zone mapping the storage account's FQDN to the private IP.
- Clients in linked VNets now resolve
mystorageaccount.blob.core.windows.net→mystorageaccount.privatelink.blob.core.windows.net→10.20.3.5(private IP).
Private DNS Zone names by service
| Service | Sub-resource | Private DNS Zone name |
|---|---|---|
| Azure Blob Storage | blob | privatelink.blob.core.windows.net |
| Azure File Storage | file | privatelink.file.core.windows.net |
| Azure SQL Database | sqlServer | privatelink.database.windows.net |
| Azure Key Vault | vault | privatelink.vaultcore.azure.net |
| Azure Container Registry | registry | privatelink.azurecr.io |
| Azure Cosmos DB (SQL) | Sql | privatelink.documents.azure.com |
Service Endpoints vs Private Endpoints — Side by Side
Understanding the differences between these two connectivity options is critical for both the exam and real-world architecture decisions. They solve similar problems but with different mechanisms and different trade-offs.
| Feature | Service Endpoints | Private Endpoints |
|---|---|---|
| Private IP in VNet | No — service retains public IP | Yes — NIC with private IP in your subnet |
| Traffic path | Azure backbone to service's public endpoint | Fully private; never touches service public IP |
| Public access disabled | No (service still accessible from internet unless separately restricted) | Yes — public access can be fully disabled |
| DNS changes required | No — FQDN still resolves to public IP | Yes — FQDN must resolve to private IP |
| Cross-subscription | Service endpoint policies only within subscription | Yes — private endpoint can target resources in other subscriptions |
| Cross-region | No — service endpoint is region-specific | Yes — private endpoint in one region can connect to a resource in another |
| On-premises access | Not directly accessible from on-premises | Yes — on-premises traffic via VPN/ExpressRoute can reach the private IP |
| Setup complexity | Low — enable on subnet, configure service firewall | Medium — create endpoint, configure DNS zone, link to VNets |
| Cost | Free (part of VNet) | Per-hour cost + per-GB data processing fee |
| When to use | Dev/test, simple scenarios, cost-sensitive environments | Production, compliance-driven, any scenario requiring full private access |
Azure Private Link
Azure Private Link is the underlying platform service that powers Private Endpoints. When you create a Private Endpoint for a PaaS resource (Storage, SQL, Key Vault, etc.), you are consuming that service through Private Link.
Private Link also enables a second scenario: Private Link Service, which lets you expose your own multi-tenant service (e.g. your application running behind a Standard Internal Load Balancer) to other VNets or customers' VNets via private endpoints — without VNet peering. This is used for ISV scenarios and service provider architectures.
For AZ-104, the important distinction is: Private Endpoint is the consumer side (in your VNet), Private Link Service is the provider side (exposing your service). The exam focuses on the Private Endpoint consumer experience.
Check Your Understanding
Click any option to see immediate feedback. Answers reflect real Azure behaviour.
1. VNet A is peered to VNet B. VNet B is peered to VNet C. A VM in VNet A cannot communicate with a VM in VNet C. What is the correct explanation?
2. You want a spoke VNet to use the hub VNet's VPN Gateway to connect to on-premises. What must be configured?
3. You created a Private Endpoint for a Storage Account in your VNet. VMs in the VNet still connect to the Storage Account's public IP instead of the private endpoint. What is the most likely cause?
myaccount.blob.core.windows.net). Without a Private DNS Zone linked to the VNet and an A record mapping the FQDN to the private IP, DNS resolution returns the public IP. The application connects to the public IP — bypassing the private endpoint entirely. Creating the private endpoint does NOT automatically configure DNS unless you select "Integrate with private DNS zone" during creation. Option D is a common misconception — public access being enabled means external callers can still reach the service, but does not affect whether internal callers route to the public or private IP. That is purely a DNS resolution issue.4. How do Service Endpoints and Private Endpoints differ in terms of the service's public endpoint accessibility?
5. In a hub-spoke topology, Spoke-A VMs need to reach Spoke-B VMs. How is this enabled without creating a direct Spoke-A to Spoke-B peering?
6. You create a Private Endpoint for a Storage Account in your East US VNet. Resources in three other spoke VNets also need to resolve the storage account to the private IP. What is the correct DNS configuration?
privatelink.blob.core.windows.net Private DNS Zone, linked to every VNet (or to the hub VNet with spoke DNS traffic forwarded to the hub). When you create the private endpoint and select "Integrate with private DNS zone", Azure automatically creates an A record in that zone mapping the storage account name to the private IP. Spokes linked to this zone (directly or via the hub DNS resolver) will correctly resolve the FQDN to the private IP. Creating separate zones per VNet (option A) creates an unmaintainable operational burden. Adding records to the public DNS zone (option B) would expose the private IP publicly and break public callers. DNS resolution through peering links is not automatic (option D) — explicit zone links are required.Also read the VNet peering overview and the DNS for private endpoints article — the DNS configuration guide is especially important for production deployments and exam scenarios involving private endpoint troubleshooting.
This lesson covered peering, hub-spoke, service endpoints, and private endpoints. Go deeper on:
- Walk me through configuring private endpoint DNS in a hub-spoke topology using Azure DNS Private Resolver — how does the conditional forwarding work from spoke VMs to the hub resolver?
- Explain the specific scenarios where Service Endpoints are still preferred over Private Endpoints in 2025 — are there any legitimate production use cases left?
- How do I automate Private DNS Zone registration for new private endpoints using Azure Policy, so that every new endpoint is automatically registered without manual intervention?
- What happens to private endpoint connectivity when the target PaaS resource is moved to a different subscription or region?