Virtual Network Peering

Connecting Azure Virtual Networks Seamlessly

What is Virtual Network Peering?

Azure Virtual Network (VNet) peering enables you to seamlessly connect Azure virtual networks. Once peered, virtual networks are connected through the Azure backbone network. This allows resources in each virtual network to communicate with each other as if they were within the same network. Traffic between peered virtual networks is private and stays on the Microsoft Azure backbone network; it does not traverse the public internet.

Key Benefits of VNet Peering:

Azure Virtual Network Peering Diagram
Conceptual diagram illustrating two peered virtual networks.

How VNet Peering Works

When you create a VNet peering connection between two VNets (VNet A and VNet B):

  1. A peering connection is established from VNet A to VNet B.
  2. A corresponding peering connection must also be established from VNet B to VNet A.
  3. Each VNet retains its own resource management and subscription.
  4. Resources within each VNet can communicate with resources in the other VNet using their private IP addresses.

Types of VNet Peering:

Peering Scenarios:

VNet peering is essential for various architectural patterns:

Considerations and Limitations:

While powerful, VNet peering has certain considerations:

Note: Ensure that your network security groups (NSGs) and Azure Firewall rules are configured to allow traffic between the peered VNets.

Configuring VNet Peering

VNet peering can be configured through the Azure portal, Azure CLI, or Azure PowerShell. The process typically involves:

  1. Navigating to the virtual network you want to peer.
  2. Selecting the "Peerings" option.
  3. Clicking "Add" and providing details for the remote VNet.
  4. Specifying whether to allow gateway transit from the remote VNet and whether to forward traffic from the local VNet to the remote gateway.

For example, using Azure CLI:


az network vnet peering create --name <PeeringName> --resource-group <ResourceGroupName> --vnet-name <VNetName> --remote-vnet <RemoteVNetId> --allow-vnet-access
            
Tip: Use descriptive names for your peering connections to easily identify their purpose.

Monitoring and Troubleshooting

Azure Monitor and Network Watcher provide tools to monitor VNet peering connections and troubleshoot connectivity issues. Common issues include overlapping IP address spaces or misconfigured NSGs.