- Configure VNet peering
- Configure network routing and endpoints
This lesson emphasizes practical Azure networking patterns and exam-relevant concepts. Expect brief CLI examples and comparisons to help you make design decisions for production and exam scenarios.
What you’ll learn
1 — VNet peering (Overview, use cases, considerations)
VNet peering connects two virtual networks in Azure so resources in both VNets can communicate directly over the Microsoft backbone. Peering provides low-latency, high-bandwidth connectivity and is commonly used to:- Isolate workloads in separate VNets while allowing private communication (e.g., prod/dev separation)
- Centralize services (e.g., logging, monitoring) in a hub VNet accessed by spoke VNets
- Migrate workloads across subscription boundaries without routing over the public internet
- Peering is non-transitive. If VNet A is peered with VNet B and VNet B is peered with VNet C, traffic from A to C is not automatically allowed through B.
- Address spaces must not overlap between peered VNets.
- You can enable or disable gateway transit and use forwarded traffic options to support specific topologies (hub-and-spoke with centralized VPN/ExpressRoute gateways).
VNet peering does not provide transitive routing. To allow traffic to traverse between networks, you must design explicit peering relationships or use a hub-and-spoke model with a supported gateway and proper gateway transit configuration.
- Wrap any subscription or resource placeholders in backticks when copying (e.g.,
/subscriptions/<SUB_ID>/...). - To support hub-and-spoke gateway transit, configure
--allow-gateway-transiton the spoke peering and--use-remote-gatewayson the spoke that uses the hub gateway.
2 — Hybrid connectivity: VPN gateways (site-to-site and point-to-site)
Azure VPN Gateway provides encrypted connectivity between Azure VNets and on-premises networks, or remote clients. Comparison of VPN gateway connection types:
Example: Basic site-to-site gateway steps (high-level)
- Create a virtual network and subnet named
GatewaySubnet(required). - Create a public IP for the VPN gateway.
- Create the VPN gateway resource.
- Configure the local network gateway (represents on-premises).
- Create the VPN connection and verify status.
3 — Azure network routing and endpoints (UDRs, private endpoints, service endpoints)
Controlling traffic flow and securing access to Azure PaaS services are common requirements.- Route tables (UDRs): Attach custom route tables to subnets to override default system routes or direct traffic to virtual appliances (NVA) or on-premises.
- Service endpoints: Extend your VNet identity to Azure PaaS services over the Azure backbone — allows firewall rules on the PaaS side to restrict to VNet subnets.
- Private endpoints: Attach a private IP from your VNet to an Azure PaaS resource, giving private access without public IP exposure.
- Use service endpoints when you want simple service-level access control and do not need full private IP addressing on the resource.
- Use private endpoints when you require private IP connectivity and DNS resolution to the private address of the PaaS resource.
- Private endpoints require DNS updates so clients resolve the PaaS resource to the private IP. You can use Azure Private DNS Zones or your own DNS server and conditional forwarding.
- Service endpoints do not change DNS resolution — endpoint traffic still uses public FQDNs but the traffic is secured to your VNet.
Practical design tips
- Plan address spaces to avoid overlaps when peering or configuring VPNs.
- Use a hub-and-spoke architecture for centralized services and gateway management.
- Leverage UDRs and NSGs together: UDRs control pathing, NSGs control allowed traffic.
- Prefer private endpoints for sensitive PaaS workloads that must not have public access.
References
- Azure Virtual Network peering
- Azure VPN Gateway overview
- Azure route tables (UDRs)
- Azure Private Endpoint documentation