How to Connect Two Azure Virtual Networks With Peering

In this blog post, I will show you how I connect two Microsoft Azure networks with virtual machines and access them.

In my case, I have one Linux VM running Centos and a Windows 10 machines. The two VMs are in two different resource groups but also in two different virtual networks.

The reason I need to connect the two networks is that I would like to SSH to the Linux machine from Windows 10 without opening SSH over the internet. This method is more secure because it keeps the SSH port closed from external access and allow me to connect from the internal Azure network.

Peering

The above concept in Azure is called Network Peering and I will show you how to do it. In my case I am going to connect the following two networks:

  • DevOps-Vnet
  • Linux-Vnet

From the portal, I will open my Windows 10 machine and click on Networking.

From the Networking page, I will click on the Virtual Network name (Devops-vnet)

From the Virtual Network page, I will click on Peering which is located on the left side menu.

To add a network connection, I will click on Add and fill in the following detals.

  • I will start with naming the peering link name.
  • Set the network setting (In my case I left everything as default)
  • Name the remote virtual network (Linux-Vnet)

In the subscription page, I will select the subscription and select the Linux-vnet virtual network and click Add to create the connection.

After a minute the peering will appear as connected. Note: In some case, you might need to repeat this process on both networks.

Now, I can open my Windows 10 machines and SSH to the local ip of my Linux VM.


Posted

in

by