Setup Azure VNET Peering
Introduction to Azure VNet Peering
Azure Virtual Networks (VNet) capabilities enables organizations to securely connect azure resources. VNet in Azure represents its own isolated network and dedicated to the subscription. Azure VNet peering enables organizations to connect two or more VNets leveraging Azure backbone network infrastructure within a same region. Once peered the azure VNets will work as a single network and resources can be accessed from both VNets.
After VNet Peering, VNets are still managed as separate resources, but virtual machines in the peered VNets can communicate with each other directly by using private IP addresses
Backbone Azure infrastructure within a region is being used for communication between VMs in the peered VNets to provide performance by providing a low-latency, high bandwidth connection between resources and access to resources on a private network in different VNets and allowing VPN gateway or network appliances as transit points in a peered VNet.
Setup Azure VNET Peering
Before we start the implementation of Azure VNet Peering, we need to ensure that we meet the following per-requisites to configure VNet Peering.
- All VNets are in the same region
- IP addresses in VNet should not overlap with each other
- Ensure these are not transitive routes
Once you fulfill the requirements for VNet Peering, follow the steps below to setp Azure VNet Peering.
- Login to Azure portal using admin credentials
- Navigate to Virtual Networks and select the VNet
- I have 2 VNets in same region
I have two VNets configured in Azure West US region.
- Select VNet_01 and click on peering
- Click on Add on right side to add the VNet Peering
- You can see the VNet Peering is added and currenty in Initiated state on VNet 1. To complete the VNet Peering, Add the VNet Peering on VNet 2
- Navigate to VNet 2 > Peering > Click on Add to add the peering
- Once the VNet Peering is added on both VNets, you will see the status of VNet peering will be updated to “Connected”
- Setup Azure VNet Peering using PowerShell
To setup Azure VNet Peering using Powershell, run the following cmdlets.
- Connect with ARM using the PS cmdlet
- Get the VNet objects for both VNets
C:\> $AzVNet1 = Get-AzureRmVirtualNetwork -ResourceGroupName AZUSWestDC01 -Name VNET_01
C:\> $AzVNet2 = Get-AzureRmVirtualNetwork -ResourceGroupName AZUSWestDC02 -Name VNET_02
- Configure the VNet Peering by running the following cmdlets
C:\> Add-AzureRmVirtualNetworkPeering -name VNetPeering_01 -VirtualNetwork $AzVNet1 -RemoteVirtualNetworkId $AzVNet2.id
C:\> Add-AzureRmVirtualNetworkPeering -name VNetPeering_02 -VirtualNetwork $AzVNet2 -RemoteVirtualNetworkId $AzVNet1.id
Azure VNet Peering is a great functionality that allow us to connect multiple VNets to a act as a single network from a connectivity standpoint. This can help us to configure multiple subscriptions together in a same region or integration of test or different business applications deployed in different VNets from security standpoint. VNet peering help us eliminate the need of using public network for communication between resources in different VNets and help improve the performance and business productivity.