Thursday 20 December 2018

Vnet-Vnet Between Different Region and Different Subscripiton

Overview:

 

This article helps you connect virtual networks (VNets) by using the VNet-to-VNet connection type. Virtual networks can be in different regions and from different subscriptions. When you connect VNets from different subscriptions, the subscriptions don't need to be associated with the same Active Directory tenant.

SetUp a xyz company network

 

Create a new Resource group :

 

 

Create a Virtual Network :

 

Create a Gateway Subnet :

 

 

 

Create a VM in your Virtual Network .

Create a Virtual Network Gateway

 

 

SetUp a ABC Company network

 

Create New resource group for abc company

 

 

Create a Virtual Network

Add SubNet

 

Create a new VM

Create a Virtual Network Gateway

Connect Abc and Xyz Virtual Network Gateway using Powershell CLI

 

Fetch the id for Vnet-Gateway using command :

 

az network vnet-gateway show -n xyz-vnet-gateway -g xyz-resgroup

 

Execute below command in Subscription 1:

 

az network vpn-connection create -n xyzvnet-abcvnet -g xyz-resgroup --vnet-gateway1 /subscriptions/subscription-id2/resourceGroups/xyz-resgroup/providers/Microsoft.Network/virtualNetworkGateways/xyz-vnet-gateway -l "West US 2" --shared-key "eeffgg" --vnet-gateway2 /subscriptions/subscription-id/resourceGroups/abc-resgroup/providers/Microsoft.Network/virtualNetworkGateways/abc-vnet-gateway

Execute below command in Subscription 2:

 

az network vpn-connection create -n abcvnet-xyzvnet -g abc-resgroup --vnet-gateway1 /subscriptions/subscription-id/resourceGroups/abc-resgroup/providers/Microsoft.Network/virtualNetworkGateways/abc-vnet-gateway -l "East US 2" --shared-key "eeffgg" --vnet-gateway2 /subscriptions/subscription-id2/resourceGroups/xyz-resgroup/providers/Microsoft.Network/virtualNetworkGateways/xyz-vnet-gateway

Test the connection :

Test the RDP using private IP from one machine to another machine.


 

No comments:

Post a Comment