VNet Peering With Step By Step Demo

In this article, I am going to explain what VNet peering is and how to establish it in Microsoft Azure.

VNet Peering allows two VNets in the same region to connect with each other without having to set up the VPN Gateways.
 
Prior to VNet Peering, we used to go with VNet to VNet connection. It didn’t matter if the VNets were in the same region or different regions.
But now, if the VNets are in the same region, we can connect them using VNet peering.

VNet to VNet connection is essentially a site-to-site connection so we need to create Virtual Network Gateways on both the VNets. But Virtual Network Gateways cost a lot of money.
 
VNet peering was introduced to remove the need for the Virtual Network Gateways. So we can connect to VNet together without the VPN gateways. It saves a lot of money. The disadvantages to this are that the VNets need to be in the same region. It won’t work cross regionally.
 
Suppose you have two different subscriptions and you have two virtual networks, one in each subscription and you want to connect them, you can do that. The only necessary thing is that they both should be in the same region.

Peering just works bi-directionally. So if you peer a VNet A with VNet B and peer VNet B with VNet C, then VNet A cannot communicate with VNet C.
 
So let us first create two virtual networks in the same region.
 
Step 1

Create a virtual network KTVNet 1 and put it into a new resource group. Put in the West India location. Click on create.
 
Azure
 
Azure

Step 2

Create one more virtual network and name it KTVNet2 and put it under the same resource group and same location; i.e., West India.
 
Azure
 
Step 3

Go to KTVNet1 and go to peerings. Click on Add.
 
Azure
 
Step 4

Give name to the peering. Select resource manager. If you don’t know the virtual machine or the subscription, you can select the resource ID. Then choose the virtual network. And keep the virtual network access as enabled.
 
Azure
 
Step 5

Allow forward traffic allows the traffic of peered VNet into this VNet. Allow gateway transit allows the peered VNet to use this VNet’s gateway (if any), but for that, "use remote gateways" must be enabled in the peered VNet. Click on OK. 
 
Azure
 
Step 6

The peering will be listed and the status will be shown as initiated. Now we need to add a peering to KTVNet2 as well. 
 
Azure
 
Step 7

Add a peering to the KTVNet2 as shown below. And keep forwarded traffic, gateway transit and remote gateways as unchecked because we do not have any gateway in any of the VNets. Click on OK.
 
Azure
 
Step 8

It can be seen in both the VNets that the connection is established.
 
Azure
 
Azure

Hence we can say that we have established a successful VNet peering.