What Is VNet peering in Networking?
On This Page
What do you want to do?
Quick Definition
VNet peering connects two separate virtual networks so they can talk to each other directly. It works across different regions and subscriptions in the cloud. Think of it like building a private bridge between two neighborhoods. No internet gateway or VPN is needed for the traffic to flow.
Common Commands & Configuration
az network vnet peering create --name PeerToHub --vnet-name SpokeVNet --remote-vnet /subscriptions/123/resourceGroups/RG1/providers/Microsoft.Network/virtualNetworks/HubVNet --allow-vnet-access true --allow-forwarded-traffic trueCreates a VNet peering from SpokeVNet to HubVNet, allowing both direct access and forwarded traffic for NVA routing.
Tests ability to configure peering with proper parameters for hub-and-spoke topologies. The --allow-forwarded-traffic flag is often required for transitive routing via an NVA.
az network vnet peering list --vnet-name VNet1 --resource-group RG1 --output tableLists all peerings for VNet1 in a table format, showing status and remote VNet.
Common troubleshooting command to check peering status. Exams may ask what command to run to verify if a peering is Connected.
Get-AzVirtualNetworkPeering -Name PeerToVNet2 -VirtualNetworkName VNet1 -ResourceGroupName RG1PowerShell command to retrieve details of a specific peering connection.
Demonstrates PowerShell syntax for Azure networking. AZ-104 exams often test PowerShell equivalents of CLI commands.
az network vnet peering update --name PeerToHub --vnet-name SpokeVNet --resource-group RG1 --allow-gateway-transit trueUpdates an existing peering to allow gateway transit, enabling the spoke to use the hub's VPN gateway.
Gateway transit is a key feature for hybrid connectivity. Exams ask about updating peering properties after initial creation.
New-AzVirtualNetworkPeering -Name PeerToVNet2 -VirtualNetwork VNet1 -RemoteVirtualNetworkId /subscriptions/456/.../VNet2 -AllowVirtualNetworkAccessCreates a peering using Azure PowerShell with explicit remote VNet ID.
Tests understanding of cross-subscription peering where resource ID is needed instead of name.
az network vnet peering delete --name PeerToVNet2 --vnet-name VNet1 --resource-group RG1Deletes a specific peering link from VNet1 to VNet2.
Deleting one side of a peering disconnects both VNets. Exams ask about the effect on connectivity.
VNet peering appears directly in 26exam-style practice questions in Courseiva's question bank — one of the most-tested concepts on SAA-C03. Practise them →
Must Know for Exams
VNet peering appears as a primary topic in the AZ-104 (Azure Administrator) and Azure Fundamentals (AZ-900) exams. For AZ-104, you are expected to configure and manage VNet peering, understand its limitations, and troubleshoot connectivity issues. The exam objectives explicitly list 'Configure VNet peering' under 'Manage and configure virtual networks'. You may be asked to create a peering between two VNets in the same region or across regions, and you must know the prerequisites, non-overlapping address spaces, proper RBAC permissions, and the fact that peering is non-transitive by default.
In the AZ-900 exam, VNet peering appears at a conceptual level. You need to understand what it does, that it uses the Microsoft backbone, and that it is a key way to connect VNets privately. You will not be asked to configure it, but you may see scenario-based questions where VNet peering is the correct answer to connect resources privately across subscriptions or regions.
For the AWS certifications, AWS Cloud Practitioner, Developer Associate, and Solutions Architect Associate, the equivalent concept is VPC Peering. It is important to know the similarities and differences. AWS VPC Peering is also non-transitive, requires non-overlapping CIDR blocks, and can be inter-region. However, AWS does not have a concept equivalent to Azure's hub gateway transit. In AWS, transitive peering is not supported; you must use a Transit Gateway for hub-and-spoke transit routing. The AWS Solutions Architect exam often tests this distinction.
The Google Cloud certifications, Associate Cloud Engineer and Cloud Digital Leader, cover VPC Network Peering. Google's implementation supports peering within the same project or across projects. It also supports custom route exchange. Questions may focus on the requirement that peered VPCs must have non-overlapping subnets and that peering is not transitive unless you use Shared VPC or a VPN-based hub.
For the CompTIA Network+ and Security+ exams, VNet peering is a light supporting concept. These exams focus more on general networking principles, but they may include cloud networking questions that mention VNet peering as a way to implement private connectivity in the cloud. You should understand the basic idea, but configuration details are not required.
The CCNA exam covers on-premises networking predominantly, but it does include cloud networking concepts in the newer exam version. VNet peering might appear as an example of how cloud providers implement private connectivity between virtual networks. Understanding the difference between peering and VPN is helpful.
Across all exams, common question patterns include: comparing VNet peering to VPN gateways, understanding when to use peering vs. a VPN, troubleshooting connectivity issues due to overlapping IP ranges, and identifying which traffic path will be used (peered vs. internet). Knowing the default behavior, non-transitive, private, backbone-based, will help you eliminate wrong answers.
Simple Meaning
Imagine you live in a gated community with several separate neighborhoods. Each neighborhood has its own streets, mailboxes, and clubhouse. Normally, people from one neighborhood cannot walk directly into another neighborhood without going out the main gate and re-entering through the other neighborhood's entrance. That is how virtual networks normally work, they are isolated by default.
VNet peering is like cutting a private gate in the fence between two neighborhoods. Suddenly, residents can walk freely from one neighborhood to the other without leaving the overall community. They can share the clubhouse, borrow a neighbor's lawnmower, or send kids to play in the other neighborhood's park. The gate is secure because only approved residents from both neighborhoods can use it. You control who and what passes through.
In the cloud, each virtual network is like its own isolated bubble. VMs, databases, and other resources live inside these bubbles. Normally, if a VM in one bubble wants to talk to a database in another bubble, the traffic has to leave the bubble, go out to the public internet, and then come back in. That is slower and less secure, like sending a letter across town through a public post office instead of handing it directly to your neighbor.
With VNet peering, the two bubbles are connected by a private, high-speed tunnel. Traffic between them never touches the public internet. It stays within the cloud provider's backbone. This makes communication faster, more secure, and cheaper because you avoid data transfer costs for traffic that leaves the network.
You can peer virtual networks in the same region or across different regions. You can peer networks in the same subscription or between different subscriptions. Even networks in different Azure Active Directory tenants can be peered, as long as both administrators agree. This flexibility is what makes VNet peering a pillar of cloud network design.
Peering is not the same as merging. Each virtual network keeps its own identity, its own IP address space, and its own resources. The gate is just a connection, not a takeover. You can also set up peering in both directions, called bidirectional peering, so traffic can flow both ways. Or you can set up one-way peering if you only need resources in one network to talk to the other.
One important rule is that the IP address spaces of the two virtual networks cannot overlap. If they use the same IP ranges, the cloud provider cannot tell which network a packet belongs to. It is like two houses having the same street number, mail would get confused. So you must plan your IP addresses carefully before you peer.
VNet peering also supports transitive routing in some cases. For example, if you have three virtual networks A, B, and C, and you peer A with B and B with C, traffic from A can reach C through B. But this only works if you enable specific settings like gateway transit or use a hub-and-spoke design. By default, peering is not transitive, A cannot go to C unless A is directly peered with C.
Overall, VNet peering is a foundational technique for building multi-tier applications, connecting on-premises networks to the cloud, and creating hub-and-spoke topologies. It is a core skill for any cloud networking professional, and it shows up often in certification exams for AWS, Azure, and Google Cloud.
Full Technical Definition
VNet peering is a networking construct that enables direct, private, and low-latency connectivity between two Azure Virtual Networks (VNets). It uses the Microsoft Azure backbone infrastructure to route traffic between address spaces without traversing the public internet, gateways, or VPN tunnels. Peering is supported for VNets within the same region (regional peering) or across different Azure regions (global peering).
When a peering is established, the Azure Fabric Controller updates the routing tables on both sides. Each VNet treats the other's address space as directly reachable. This means that any resource inside the peered VNet, such as virtual machines, load balancers, Application Gateways, or Azure Kubernetes Service pods, can communicate with resources in the other VNet as if they were on the same local network, subject to network security group (NSG) and route table rules.
There are two types of peering: virtual network peering and global virtual network peering. Regional peering connects VNets in the same Azure region. Global peering connects VNets across different Azure regions. Global peering introduces a slight latency compared to regional peering but still offers lower latency and higher reliability than internet-based communication.
Peering is non-transitive by default. If VNet A is peered with VNet B, and VNet B is peered with VNet C, VNet A cannot communicate with VNet C unless a direct peering is created between A and C, or you configure a hub VNet with an Azure VPN Gateway or Azure Route Server to enable transit routing. To enable transitive routing, you can set the 'Allow gateway transit' option on the peering connection and configure the peered VNet to 'Use remote gateways'. This allows the remote VNet to use the hub's VPN or ExpressRoute gateway for connectivity to on-premises or other networks.
Peering works across subscriptions, Azure Active Directory tenants, and even across different Azure deployments (Azure Resource Manager to classic VNets, though classic is deprecated). To peer across subscriptions, both administrators must grant the appropriate role-based access control (RBAC) permissions, typically the Network Contributor role on both VNets.
Important technical constraints include non-overlapping IP address spaces. You cannot peer VNets that have overlapping CIDR blocks because the routing tables would have ambiguous entries. Also, when peering globally, data transfer costs apply. Inbound and outbound data transfer across peered VNets is billed at a reduced rate compared to internet egress, but it is not free.
From a protocol perspective, VNet peering does not introduce any new protocol. It is a layer 3 routing abstraction implemented by the Azure platform. All standard IP-based protocols (TCP, UDP, ICMP) work across peered VNets. Multicast, broadcast, and IP-in-IP encapsulation are not supported. Network security groups (NSGs) and application security groups (ASGs) can be applied to subnets or NICs to control east-west traffic between peered VNets.
Azure DNS can resolve names across peered VNets if you configure custom DNS servers or use Azure Private DNS Zones with appropriate linking. Without custom DNS, VMs in peered VNets cannot resolve each other's hostnames by default; they must use private IP addresses.
In AWS, the equivalent service is VPC Peering, which similarly connects two VPCs for direct private communication. In Google Cloud, the equivalent is VPC Network Peering. Each cloud provider's implementation has subtle differences in transitive routing support, cost, and regional constraints. AWS VPC Peering is also non-transitive by default, but it supports inter-region peering. Google Cloud supports peering within the same organization or across different organizations.
Real IT implementation of VNet peering often involves hub-and-spoke topologies. A central hub VNet hosts shared services like firewalls, domain controllers, or VPN gateways. Spoke VNets are peered to the hub and route their traffic through the hub for inspection. This design centralizes security policy enforcement and reduces management overhead. It also enables transitive routing because the hub gateway can route traffic between spokes that are not directly peered.
Another common pattern is the mesh topology, where multiple VNets are all peered with each other. This provides direct connectivity but increases management complexity because each pair must be configured. For large-scale deployments, hub-and-spoke is preferred over full mesh.
Monitoring VNet peering health can be done using Azure Monitor metrics like 'Peering Status' and 'Inbound/Outbound Traffic'. The peering status can be 'Connected', 'Disconnected', or 'Provisioning'. If the status is 'Disconnected', one side of the peering has been deleted or is not properly configured. Alerts can be set up to detect status changes.
Troubleshooting VNet peering involves verifying that both sides of the peering are created and the status is 'Connected', checking NSG rules for both inbound and outbound directions, validating effective routes using the 'Effective Routes' view in the Azure portal, and ensuring that DNS resolution is configured if needed.
Real-Life Example
Imagine two office buildings in a large business park. Each building is a separate virtual network. Building A has the marketing team, and Building B has the engineering team. Normally, if someone in marketing wants to talk to someone in engineering, they would have to walk out the front door of Building A, cross the parking lot, and enter the front door of Building B. That is like traffic going out to the public internet and coming back in.
VNet peering is like building a covered skybridge that connects the second floor of Building A directly to the second floor of Building B. Employees can now walk between the two buildings without going outside. The skybridge is private, only people with badges from either building can use it. The walk is faster and more comfortable. This is exactly how VNet peering works: it creates a private, direct path between two virtual networks.
Now imagine you manage both buildings. You might want the security guard in Building A to monitor the entrance of Building B, but you do not want to merge the two teams into one giant building. With a skybridge, the guard can walk over to check things, but the offices remain separate. You keep each team's furniture, their own break room, and their own Wi-Fi network. That is the non-transitive nature of peering, the buildings are connected but remain independent.
Suppose you add a third building for the HR team. If you only build a skybridge from Building A to Building B and from Building B to Building C, the marketing team in Building A cannot directly walk to Building C. They would have to walk to Building B first and then take another skybridge. That is the default non-transitive routing. But if you want direct access from A to C, you need to build another skybridge directly between them. This mirrors the hub-and-spoke topology, where Building B acts as the hub, and you allow transit through B by enabling gateway transit.
Now consider security. The skybridge has a gate that requires a badge on both sides. Even with the skybridge, the marketing team cannot access the engineering team's private meeting room unless they have permission. This is like network security groups (NSGs) that control which traffic flows between peered VNets. The peering opens the connection, but NSGs define who can use it.
If one of the buildings changes its address, like a renumbering of office numbers, the skybridge might not work anymore. In the cloud, this means you cannot peer VNets with overlapping IP address spaces. The address ranges must be unique, just like each building needs a unique street address.
Finally, think about the cost. Walking through the parking lot in the sun (internet traffic) might be cheap but uncomfortable. Walking through a climate-controlled skybridge (peered traffic) is a better experience but costs something to maintain. Similarly, global VNet peering costs money for data transfer, while regional peering is usually free for inbound traffic and cheaper for outbound. Understanding these real-world trade-offs helps you design cost-effective cloud networks.
Why This Term Matters
VNet peering is a foundational skill for any cloud networking professional because it directly impacts how applications are architected, secured, and scaled. Without VNet peering, connecting resources across different virtual networks would require complex VPNs, public IP addresses, or third-party appliances, all of which introduce latency, cost, and security risks.
In modern cloud environments, very few applications live inside a single virtual network. Multi-tier applications often have separate VNets for the web layer, application layer, and database layer. VNet peering allows these tiers to communicate privately while maintaining isolation. This separation improves security because you can apply granular NSG rules at each tier without exposing the database directly to the internet.
For enterprises with hybrid deployments, part on-premises, part in the cloud, VNet peering is essential for connecting multiple cloud landing zones. A hub VNet might contain a VPN or ExpressRoute gateway connected to the on-premises data center. Spoke VNets for different departments or environments (dev, test, prod) are peered to the hub. This centralizes connectivity and simplifies compliance audits.
Cost optimization is another reason VNet peering matters. Data transfer between peered VNets does not incur internet egress charges. For applications that move large amounts of data between services, such as data analytics pipelines or media processing workflows, peering can significantly reduce bandwidth costs. Regional peering is free for inbound traffic, though outbound traffic is billed at lower rates than internet traffic.
High availability and disaster recovery also rely on VNet peering. You can peer VNets across regions to replicate databases or deploy active-active application stacks. When one region fails, traffic can be redirected to the other region over the private peering connection, avoiding the public internet and maintaining low latency failover.
Finally, VNet peering simplifies network management. Instead of managing multiple VPN tunnels, IPsec policies, and route tables for each external network, you create a single peering connection per VNet pair. The cloud provider handles the underlying routing updates automatically. This reduces operational overhead and the chance of misconfiguration.
How It Appears in Exam Questions
VNet peering questions typically fall into a few patterns. The first is the straightforward scenario: 'You have two VNets, VNet1 and VNet2, in the same Azure region. You need to enable private communication between VMs in each VNet. What should you do?' The correct answer is create a VNet peering between the two VNets. Distractors might include deploying a VPN gateway, creating a load balancer, or configuring Azure DNS.
The second pattern focuses on transitive routing. 'You have three VNets: Hub, Spoke1, and Spoke2. Hub is peered to Spoke1 and Spoke2. Can Spoke1 communicate with Spoke2 directly?' The correct answer is no, because peering is non-transitive by default. The exam might ask what additional configuration is needed, like enabling 'Allow gateway transit' on the hub and 'Use remote gateways' on the spokes, or adding a direct peering between the spokes.
The third pattern tests global vs. regional peering. 'You need to connect two VNets located in different Azure regions. Which peering type should you use?' The answer is global VNet peering. Distractors might include regional VNet peering (only works in same region) or VPN gateway (unnecessary overhead).
The fourth pattern involves overlapping IP addresses. 'You attempt to create a VNet peering but receive an error. What is the most likely cause?' The answer is that the two VNets have overlapping address spaces. You may also see questions about DNS resolution: 'Two VNets are peered. VMs in VNet1 cannot resolve hostnames of VMs in VNet2. What is missing?' The answer is custom DNS servers or Azure Private DNS zones.
The fifth pattern is about connectivity testing. 'After configuring VNet peering, you cannot ping a VM in the peered VNet. What should you check first?' The answer is the NSG rules on both VMs' subnets or NICs. Distractors might include checking the peering status (which is connected) or the route tables (which should show the remote address space).
Finally, cost questions appear in the Azure Fundamentals and AWS Cloud Practitioner exams. 'Which is cheaper: routing traffic between two peered VNets or through a VPN over the internet?' The answer is peered VNets, because traffic stays on the provider's backbone and does not incur internet egress charges. However, note that global peering still has data transfer costs, just lower than internet egress.
Practise VNet peering Questions
Test your understanding with exam-style practice questions.
Example Scenario
Imagine you are a cloud administrator for a company called Contoso. You have two applications running in Azure. The first application is a customer-facing web app hosted in a VNet called 'WebVNet'. The second application is a backend database hosted in a separate VNet called 'DBVNet'. The security team has mandated that the database VNet should never have a public IP address, and the web app VNet should only accept traffic from the internet.
Currently, the web app cannot talk to the database because they are in different VNets. Your task is to enable private communication so the web app can query the database without exposing the database to the internet.
You decide to use VNet peering. You create a peering from WebVNet to DBVNet, and a second peering from DBVNet to WebVNet (bidirectional peering). You ensure that the IP address spaces do not overlap. WebVNet uses 10.0.0.0/16 and DBVNet uses 10.1.0.0/16, no overlap.
After creation, the peering status shows 'Connected' on both sides. You then update the NSG on the DBVNet subnet to allow inbound traffic from the WebVNet subnet (10.0.0.0/16) on port 1433 (SQL Server). You also update the NSG on the WebVNet subnet to allow outbound traffic to the DBVNet on port 1433.
Now the web app can communicate with the database privately. Traffic flows over the Azure backbone. There is no public exposure. The database remains secure. You also save money because you are not paying for VPN gateway hours or internet data transfer.
This scenario tests your understanding of the peering creation process, the need for bidirectional peering (unless explicitly one-way), the non-overlapping IP requirement, and the crucial step of configuring NSGs. Many learners forget that peering creates the network connection but does not automatically allow traffic, NSGs still block or allow the actual flows.
In an exam, you might be asked what the next step is after creating the peering. The correct answer is to check NSG rules. Or you might be asked why connectivity fails even though the peering status is 'Connected'. The answer is almost always an NSG rule blocking traffic.
Common Mistakes
Assuming VNet peering is transitive by default
Peering is non-transitive. If VNet A is peered to B, and B is peered to C, A cannot reach C without direct peering or a hub gateway with transit enabled.
Always check whether you need transitive routing. If you do, either create direct peering between each pair or configure hub gateway transit.
Creating peering in only one direction
A single peering link only allows traffic to flow in the direction of the peering. For bidirectional communication, you must create two peerings: one from each VNet to the other.
When creating peering, explicitly create the reverse peering from the second VNet back to the first, or use the 'Create the reverse peering automatically' option in the Azure portal.
Peering VNets with overlapping IP address spaces
Azure cannot route traffic if both VNets claim the same IP range because it does not know which network a packet belongs to.
Before peering, verify that the address spaces are unique. Use different CIDR blocks, such as 10.0.0.0/16 for one VNet and 10.1.0.0/16 for the other.
Forgetting to update NSGs after peering
Peering creates a network path, but NSGs still filter traffic. If NSGs are not updated to allow the cross-VNet traffic, communication will fail silently.
After enabling peering, review the NSGs on both sides. Add inbound and outbound rules as needed to allow the specific ports and protocols required by your application.
Thinking VNet peering supports transitive routing with a VPN gateway automatically
Even with a VPN gateway in the hub, peering does not automatically enable transit unless you enable 'Allow gateway transit' on the hub peering and 'Use remote gateways' on the spoke peering.
If you need spoke VNets to communicate through a hub gateway, configure these settings during peering. Without them, the hub gateway will not route traffic between spokes.
Exam Trap — Don't Get Fooled
{"trap":"A question asks: 'You need to connect three VNets so that all can communicate with each other. You create a peering between A and B, and between B and C. Will A be able to reach C?'
The answer 'Yes, because B acts as a router' is a tempting trap.","why_learners_choose_it":"Learners think that if B can talk to both A and C, it will naturally forward traffic between them, like a router or switch. This is logical from a physical network perspective but incorrect in cloud peering."
,"how_to_avoid_it":"Remember the rule: VNet peering is non-transitive by default. Azure does not allow a VNet to forward traffic to another VNet unless explicitly configured with gateway transit. Always look for the words 'non-transitive' in your study notes.
If the question does not mention gateway transit configuration, assume no transitive routing."
Commonly Confused With
A VPN Gateway connects an on-premises network to Azure or connects two VNets over the public internet using encrypted tunnels. VNet peering connects two Azure VNets directly over the Microsoft backbone without encryption or a dedicated gateway device. Peering is faster and cheaper for Azure-to-Azure traffic, while VPN is used for hybrid connectivity.
You have an on-premises data center and an Azure VNet. Use a VPN Gateway. You have two Azure VNets in the same region. Use VNet peering.
ExpressRoute provides a dedicated, private connection from an on-premises network to Azure, bypassing the public internet. VNet peering connects two Azure VNets, not on-premises to Azure. ExpressRoute is for hybrid connectivity, while VNet peering is for cloud-to-cloud connectivity.
You need to connect your company's headquarters to Azure. Use ExpressRoute. You need to connect your dev VNet to your test VNet. Use VNet peering.
Azure Virtual WAN is a managed networking service that creates a hub-and-spoke architecture with built-in transit routing. VNet peering is a simpler, point-to-point connection. Virtual WAN automatically handles transitive routing between spokes, while peering requires manual configuration for transitive connectivity.
You have 50 VNets that all need to communicate. Use Virtual WAN. You have two VNets that need to exchange data. Use VNet peering.
Azure Firewall is a managed, cloud-based network security service that inspects and filters traffic. VNet peering is a connectivity method that does not inspect traffic. You can use them together: peer VNets and route traffic through Azure Firewall for inspection.
You need to allow traffic between two VNets but also log and filter it. Configure VNet peering between them, then create a route table that forces the traffic through Azure Firewall.
Practical Mini-Lesson
VNet peering is a foundational skill for any cloud networking professional. In practice, setting up peering is straightforward through the portal, CLI, or Infrastructure as Code tools like Terraform or ARM templates. However, the real challenge lies in understanding the implications for routing, security, and cost.
When you peer two VNets, Azure adds a system route to each VNet's route table that directs traffic for the peered network's address space to the Azure backbone. You can view these routes in the Azure portal under 'Route tables' or 'Effective routes'. By default, traffic can flow both ways if both peerings are configured. You can also restrict direction by unchecking 'Allow traffic from remote VNet' or 'Allow forwarded traffic' during peering setup.
One common practical scenario is the hub-and-spoke design. In this model, you create a hub VNet that contains shared resources like a firewall or a domain controller. Each spoke VNet is peered to the hub. To enforce that all traffic between spokes goes through the hub, you must disable 'Allow forwarded traffic' on the spoke-to-spoke peerings (if any) and configure routes on the hub to forward traffic between spokes via a firewall. This requires careful use of UDRs and network virtual appliances.
Another practical consideration is DNS resolution. By default, peered VNets do not automatically resolve each other's private DNS names. If you want VMs in VNetA to resolve the private IP of a VM in VNetB by hostname, you need to configure custom DNS servers or use Azure Private DNS Zones. This is a common oversight that leads to connectivity failures even when peering is correctly set up.
Cost management is also critical. Regional VNet peering does not incur data transfer charges for traffic within the same region. However, global VNet peering charges for both inbound and outbound data transfer. These costs can add up quickly for data-intensive applications. As a professional, you should always estimate the data transfer volume before deciding between peering, VPN, or other connectivity options.
In production environments, always implement monitoring. Use Azure Monitor or Network Watcher to track peering health, latency, and packet loss. Set up alerts for peering status changes or unusual traffic patterns. This proactive approach helps you catch issues before they affect users.
Finally, remember that VNet peering is not a substitute for a transit gateway in large topologies. If you have more than a handful of VNets that all need to communicate, a transit gateway simplifies management and provides transitive routing. Evaluate the number of connections and routing requirements to choose the right tool.
What VNet Peering Is and Why You Use It
VNet peering is a networking feature that allows you to connect two or more virtual networks (VNets) in Microsoft Azure directly, and with low latency. It enables resources in different VNets to communicate with each other as if they were on the same physical network, using the Microsoft backbone infrastructure rather than traversing the public internet. This is a fundamental concept for the AZ-104 and Azure Fundamentals exams, as well as for anyone building multi-tier or multi-region applications in Azure.
The primary purpose of VNet peering is to facilitate private IP connectivity between VNets. Unlike traditional site-to-site VPNs or ExpressRoute connections, peering does not require a gateway, VPN device, or public IP address. Traffic flows entirely within Azure's secure network, reducing latency and increasing throughput. Peering can be established between VNets in the same region (regional peering) or across different Azure regions (global peering). Global peering is especially important for geo-redundant architectures, disaster recovery, and hybrid cloud scenarios.
One key exam point is that VNet peering is not transitive by default. If VNet A is peered with VNet B, and VNet B is peered with VNet C, VNet A cannot communicate with VNet C unless you explicitly create a direct peering between A and C. This is a common source of confusion and a frequent exam trap. To enable transitive routing, you must use network virtual appliances (NVAs) or deploy a hub-and-spoke topology with a hub VNet that has peerings to multiple spokes.
Another important aspect is that peered VNets can have overlapping IP address spaces. This is a significant limitation and will cause peering to fail. Azure enforces that the address spaces of the VNets being peered must not overlap. You can, however, have subnets within the same VNet that overlap with subnets in a peered VNet, as long as the overall VNet address spaces do not conflict. This is tested in exam questions about design considerations.
Peering is also used for managed services like Azure Kubernetes Service (AKS), Azure SQL Managed Instance, and Azure App Service, which may require connectivity to resources in different VNets. For example, an AKS cluster often needs to peer with a database VNet to communicate with Azure SQL Database without exposing a public endpoint. This scenario appears in the AWS Developer Associate exam context (since it covers similar concepts for VPC peering in AWS), but Azure-focused exams specifically ask about VNet peering for these use cases.
Finally, VNet peering is a cost-effective solution. While data transfer within a region is generally free (or very low cost), global peering incurs egress charges based on the amount of data transferred between regions. Understanding the pricing model helps architects design cost-efficient solutions. In the Azure Fundamentals and AZ-104 exams, questions often ask about when to use peering versus VPN or ExpressRoute, so you must know that peering is best for low-latency, high-bandwidth intra-organization communication without public internet exposure.
How to Configure VNet Peering in Azure
Configuring VNet peering in Azure involves a few clear steps that are tested in the AZ-104 and Azure Fundamentals exams. You can do it through the Azure portal, Azure CLI, PowerShell, or ARM templates. The process always requires two VNets that you want to connect, and you must create two peering links-one from each VNet to the other. This bidirectional nature is critical: if you only create one peering from VNet A to VNet B, traffic is not allowed in the reverse direction.
To start, ensure that the two VNets exist in the same or different Azure subscriptions, and that they do not have overlapping IP address ranges. You can use the Azure portal by navigating to a VNet, selecting "Peerings" under Settings, and clicking "Add". You must specify the remote VNet (by resource ID or by selecting from a list), choose a name for the peering link, and decide whether to allow virtual network access, forwarded traffic, and gateway transit. These options are important for exam questions: allowing forwarded traffic is necessary if you plan to use an NVA in one VNet to route traffic between other VNets, and gateway transit enables a spoke VNet to use the hub VNet's VPN gateway for connectivity.
A common exam scenario involves creating a peering between two VNets in different Azure regions (global peering). Global peering does not require any special configuration beyond selecting the remote VNet, but there are limitations: you cannot use global VNet peering between VNets in the same region? Actually, global peering is for cross-region, and regional peering is for same-region. The key limitation is that global peering does not support gateway transit if the hub VNet is in a different region. Also, you cannot peer VNets that are in the same geography but different regions if one of them uses Basic Load Balancers? That is a myth: Basic Load Balancers are not supported behind global VNet peering for inbound traffic. This is a specific exam point for AZ-104.
When using command line tools, the Azure CLI commands are: az network vnet peering create. You provide parameters like --vnet-name, --name, --remote-vnet, and --allow-vnet-access. For example: az network vnet peering create --name PeerToVNet2 --vnet-name VNet1 --remote-vnet /subscriptions/.../VNet2 --allow-vnet-access true. You must run this on both VNets. In the Azure Fundamentals and AZ-104 exams, they often show a snippet of this command and ask what is missing or what it does.
Another configuration detail is that you can set the peering status to "Connected" only after both links are created. If you create only one side, the status will be "Initiated". The exam tests this by presenting a scenario where an administrator can't connect to a resource after setting up one peering, and the answer is that the remote peering link is missing.
Finally, you can also delete or update peerings over time. If you delete one side, the other side becomes "Disconnected". This is important for troubleshooting and is a common source of error in practice labs. The command az network vnet peering delete is used for removal. For PowerShell, the equivalent is Remove-AzVirtualNetworkPeering. Understanding these commands is essential for the developer associate and administrator exams, where automation is key.
VNet Peering Cost Structure and Service Limits
Understanding the cost and limits of VNet peering is critical for cloud architects and is heavily tested in Azure certifications like AZ-104 and Azure Fundamentals. VNet peering is not free; it incurs charges based on data transfer, but there are no upfront fees. For regional peering (within the same Azure region), data transfer between VNets is typically free for inbound and outbound traffic? Actually, Microsoft's documentation states that data transfer between VNets in the same region via peering is not charged. However, for global VNet peering (across regions), you pay standard Azure egress rates for data leaving one region to another. This pricing model is a key differentiator from using VPN or ExpressRoute, which have their own costs.
Exam questions often present a scenario where an organization has VNets in East US and West US and needs to transfer large amounts of data. They ask which networking solution is most cost-effective. The correct answer is usually global VNet peering because it uses the Microsoft backbone and has no per-minute charges, only data transfer costs. However, if the data transfer is extremely high, ExpressRoute might be cheaper due to committed bandwidth pricing. But for most scenarios, peering is the cheapest private connectivity option.
In addition to cost, there are service limits that you must memorize. Azure imposes a maximum number of peerings per VNet. For most VNet sizes, you can have up to 500 peerings per VNet (as of the latest documentation). This is a soft limit that can be increased by contacting support. For global peering, there is also a limit on the number of VNets you can peer across regions. The exam might ask: "You have a VNet with 400 peerings already. You need to connect to 150 more VNets. What should you do?" The answer is to either increase the limit via support or use a hub-and-spoke topology where each spoke peers only to the hub.
Another limit is that VNet peering does not support transitive routing. This is not a hard limit but a design limitation. If you need transitive connectivity, you must deploy NVAs or use Azure Route Server. The exam loves to test this by giving a scenario where VNet A and B are peered, B and C are peered, and they ask why A cannot reach C. The answer is the lack of transit.
Also, you cannot peer VNets that have overlapping address spaces. This is a strict limitation. If you attempt to create a peering and the address spaces overlap, Azure will throw an error. The exam might present a situation where an administrator tries to peer two VNets with ranges 10.0.0.0/16 and 10.0.0.0/24, which overlap, and the answer is to re-address one of the VNets.
For global peering, there are additional limitations: you cannot use global peering with Basic Load Balancers that are behind the peering. If you have a Basic Load Balancer in one VNet and try to access it from a peered VNet in another region, the traffic will fail. You must use Standard Load Balancer instead. This is a specific exam trap.
Finally, there is a limit on the number of VNet peerings per subscription? Actually, there is no per-subscription limit for peerings; only per VNet. But you can have up to 500 VNets per region per subscription, so the number of peerings is effectively bounded by that. For the exams, just remember the 500 peerings per VNet limit and the fact that you can request an increase.
Security Implications of VNet Peering
When you peer two VNets, you are essentially extending the network boundary, which introduces several security considerations. Microsoft Azure's exam objectives for the Security Plus, AZ-104, and Azure Fundamentals emphasize that peering does not automatically secure traffic; you must explicitly apply network security groups (NSGs) and firewall rules. By default, peered VNets allow all traffic between them, which can be a security risk if you have sensitive resources in one VNet.
To restrict traffic, you can use NSGs on subnets or virtual machine NICs. For example, you can create an NSG rule that denies inbound traffic from a specific IP range in the remote VNet. This is useful for micro-segmentation. The exam often presents a scenario where an administrator has peered two VNets and later discovers unauthorized access. The solution is to apply NSGs to block unnecessary ports.
Another security feature is that you can use Azure Firewall or a third-party NVA to inspect traffic between peered VNets. This is necessary for compliance requirements, such as logging all traffic between production and development VNets. You deploy the firewall in a hub VNet and force all traffic from spokes through the firewall using user-defined routes (UDRs) and the "Allow forwarded traffic" peering option. This is a common design pattern tested in the AZ-104 and Network+ exams.
Data protection in transit is a key exam topic. VNet peering traffic is encrypted by default within the Azure backbone, so you don't need to enable additional encryption for confidentiality. However, if you have compliance requirements for end-to-end encryption, you can still use IPsec or TLS at the application layer. The exam might ask: "Is VNet peering traffic encrypted?" The correct answer is yes, at the Azure network layer, but not necessarily application-visible.
Another security consideration is that peering can be established across subscriptions and even across Azure Active Directory tenants. This introduces cross-tenant security risks. You must ensure that the remote VNet's owner is trusted, because peering gives them direct network access to your resources. Microsoft recommends using Azure Policy to enforce that only authorized VNets can be peered. The exam may ask about using Policy to restrict peering to specific subscriptions.
Gateway transit in peering also has security implications. If you allow gateway transit in a hub VNet, spoke VNets can use the hub's VPN gateway to connect to on-premises networks. This means that all traffic from the spoke to on-premises must be authenticated by the hub's gateway policies. If the hub's gateway is compromised, all spokes are at risk. The exam will test your understanding of this shared responsibility model.
Finally, remember that you can use VNet service endpoints or private endpoints with peered VNets. For example, you can peer a VNet that contains a private endpoint for Azure Key Vault, and then resources in another peered VNet can access the Key Vault securely. This is a best practice for securing PaaS services and appears in the Azure Developer Associate exam.
By properly implementing NSGs, firewalls, and UDRs, you can create a secure peered network topology that meets most enterprise requirements. The Security Plus exam specifically tests your ability to recommend these controls.
Troubleshooting Clues
Peering status stuck at 'Initiated'
Symptom: After creating a peering from VNet A to VNet B, the status shows 'Initiated' instead of 'Connected'.
Peering requires a bidirectional link: you must create a peering from VNet B back to VNet A. If only one side is created, the status remains Initiated.
Exam clue: Exam questions present a scenario where connectivity fails after setting up peering on one side, testing knowledge that both links are required.
Traffic blocked by overlapping address spaces
Symptom: When attempting to create VNet peering, you receive an error message: 'Address space overlaps with remote VNet'.
Azure does not allow peering between VNets with overlapping IP address ranges because route ambiguity would occur.
Exam clue: The exam tests that you must re-address one VNet or use a different IP range before peering.
Global VNet peering not working with Basic Load Balancer
Symptom: Virtual machines behind a Basic Load Balancer in one region cannot be reached from VMs in a globally peered VNet in another region.
Global VNet peering does not support Basic Load Balancers for inbound traffic. You must upgrade to Standard Load Balancer.
Exam clue: This is a specific exam trap: the answer is to use Standard Load Balancer for global peering scenarios.
Cannot use gateway transit with global VNet peering
Symptom: A spoke VNet in another region cannot use the hub's VPN gateway even though gateway transit is enabled on the peering.
Gateway transit is only supported for regional VNet peering, not global peering. Global peering does not allow transit through gateways.
Exam clue: Exam questions ask: 'You peer a VNet in East US with a VNet in West US. Can spoke VNets use the hub's gateway?' The answer is no.
Peered VNets cannot communicate despite both peerings showing 'Connected'
Symptom: Both peering links show status 'Connected', but VMs in the two VNets cannot ping each other.
Network Security Groups (NSGs) on the subnets or NICs may be blocking ICMP or other traffic. By default, peerings allow all traffic, but NSGs override.
Exam clue: Exams test that NSGs are evaluated after peering, so a 'Deny All' NSG can block peering traffic despite the connection being established.
Resources in peered VNet unable to resolve DNS names
Symptom: Virtual machines in VNet A can use private IP addresses to communicate with VNet B, but DNS name resolution fails.
VNet peering does not automatically configure DNS resolution between VNets. You must either use custom DNS servers or configure Azure Private DNS zones that are properly linked.
Exam clue: This is a common exam question: you need to use Azure Private DNS zones with a 'virtual network link' to resolve names across peered VNets.
Transitive connectivity fails between three peered VNets
Symptom: VNet A is peered with VNet B, and VNet B is peered with VNet C, but VNet A cannot communicate with VNet C.
VNet peering is not transitive by design. Traffic between A and C must go through B, but Azure does not forward traffic between peerings unless you configure an NVA or Azure Route Server.
Exam clue: This is a classic exam trick: they ask why A cannot reach C, testing that you need a hub-and-spoke with a firewall or router.
Memory Tip
Think 'P' for Private: Peering is Private, point-to-Point, and requires Peerings on both sides to work (two 'P's).
Learn This Topic Fully
This glossary page explains what VNet peering means. For a complete lesson with labs and practice, see the topic guide.
Covered in These Exams
Current Exam Context
Current exam versions that test this topic — use these objectives when studying.
SY0-701CompTIA Security+ →CLF-C02CLF-C02 →SAA-C03SAA-C03 →DVA-C02DVA-C02 →220-1101CompTIA A+ Core 1 →200-301Cisco CCNA →N10-009CompTIA Network+ →AZ-104AZ-104 →ACEGoogle ACE →CDLGoogle CDL →AZ-900AZ-900 →PCAGoogle PCA →Related Glossary Terms
A local text file on Unix-like operating systems that manually maps hostnames to IP addresses, overriding DNS for specified entries.
/etc/resolv.conf is a configuration file on Linux and Unix-like systems that tells the computer which Domain Name System (DNS) servers to use when converting domain names like google.com into IP addresses.
An Application Gateway is a network device or cloud service that manages and secures traffic between users and web applications by applying rules, routing requests, and offloading tasks like SSL encryption.
An Application Security Group (ASG) is a cloud networking feature that groups virtual machines logically and allows you to apply security rules based on the application workload, rather than individual IP addresses.
Address Resolution Protocol (ARP) is a network protocol used to map a device's IP address to its physical MAC address so data can be delivered correctly on a local network.
An Availability Set is a logical grouping of virtual machines in Azure that helps ensure high availability by distributing VMs across different physical hardware within a datacenter.
Quick Knowledge Check
1.An administrator creates a VNet peering from VNet1 to VNet2, but does not create a peering from VNet2 back to VNet1. What will be the status of the peering on VNet1?
2.Which of the following is a valid reason to use global VNet peering instead of VPN?
3.A company has two VNets with address spaces 10.0.0.0/16 and 10.0.0.0/24. They try to create a peering and get an error. What should they do?
4.What is the maximum number of VNet peerings allowed per VNet (default limit)?
5.You have peered VNet A in West US with VNet B in East US. You need VMs in VNet A to access a Standard Load Balancer in VNet B. What must you configure?
Frequently Asked Questions
Is VNet peering transitive?
No. VNet peering is not transitive. If VNet A is peered with VNet B, and VNet B is peered with VNet C, VNet A cannot reach VNet C through B. To connect A and C you must create a direct peering, or use a hub-spoke architecture with Azure Virtual WAN or a Network Virtual Appliance (NVA) configured for forwarding.
What is the difference between VNet peering and a VPN gateway?
VNet peering routes traffic privately over the Azure backbone with low latency and no bandwidth gateway limits. A VPN gateway encrypts traffic and supports hybrid connectivity to on-premises or other cloud networks, but introduces latency overhead and bandwidth constraints. For Azure-to-Azure connectivity, peering is preferred.
Can you peer VNets across Azure regions?
Yes. Global VNet peering connects VNets in different Azure regions over the Microsoft backbone — not the public internet. Cross-region traffic incurs additional charges. This is commonly tested in AZ-104 multi-region architecture scenarios.
Can you peer VNets in different subscriptions?
Yes. Cross-subscription peering is supported and commonly tested in AZ-104. A peering resource must be created in both VNets — one in each subscription. The user creating the peering must have the Network Contributor role (or equivalent) on both VNets.
Can peered VNets have overlapping address spaces?
No. Peered VNets must have non-overlapping CIDR blocks. If two VNets both use 10.0.0.0/16, peering creation fails. This is a frequent AZ-104 exam scenario: you must re-address one VNet before peering can succeed.
Does resizing a VNet address space break existing peerings?
Yes. If you need to resize a peered VNet's address space, you must delete all peerings first, make the change, then re-add the peerings. This is a disruptive operation — plan for a maintenance window. AZ-104 questions test this constraint.
Summary
VNet peering is a cloud networking feature that creates a direct, private, and high-bandwidth connection between two virtual networks within the same cloud provider. It is a pillar of modern cloud architecture because it enables secure communication between application tiers, supports hub-and-spoke topologies, and allows for cross-region connectivity without traversing the public internet. Unlike VPN gateways, VNet peering does not encrypt traffic by default, but it offers lower latency and cost.
For IT certification candidates, mastering VNet peering is crucial. It appears heavily in AWS, Azure, and Google Cloud exams, with questions focusing on when to use peering versus other connectivity options, configuration steps, and troubleshooting. The most common pitfalls include assuming transitive routing, forgetting to update route tables, and overlooking security group rules. A solid understanding of peering will help you design scalable, secure, and cost-effective cloud networks.
The key exam takeaway is that VNet peering is a point-to-point, non-transitive, private link that requires non-overlapping IP spaces and explicit route configuration. Always verify routes and security groups after setup. With proper planning, VNet peering is a simple yet powerful tool for connecting your cloud resources.