TransWikia.com

How to Connect Two Azure Virtual Network Gateways in Different Azure Directories

Super User Asked by bikerben on January 27, 2021

My interpretation of the Microsoft documentation leads me to believe that I can connect two Virtual Network Gateways within two different Azure Directories but it will need to be done via PowerShell. Is this correct?

If so could would someone please either point me in the right direction to some steps to implement this?

Any help would be greatly appreciated.

One Answer

It looks like I over complicated what I need to do as I could just setup a network peering between two separate Azure Directory Tenets using PowerShell.

Although the Azure Portal does allow network peering within the same Azure Directory Tenant it does not show an option to setup a network peering between two networks in separate Tenants. Below is the Powershell script I used to achieve this:

## Peer AzureUK to AzureUS
## Selecting the UK Subscription where the domain controllers virtual network resides.

Set-AzContext -SubscriptionId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx"

## Select the UK Virtual Network and the Resource Group containing the domain controllers
$vNetA=Get-AzVirtualNetwork -Name Azure.yourdomain.com -vnet -ResourceGroupName Azure.yourdomain.com
Add-AzVirtualNetworkPeering `

## Specify the name of the Peering as seen from the UK directory tenant.

-Name 'AzureUK-to-AzureUS-Peering' `
-VirtualNetwork $vNetA `

## Specify the Resource ID of the remote virtual network within the US directory tenant.

-RemoteVirtualNetworkId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/resourceGroups/Networks/providers/Microsoft.Network/virtualNetworks/PulicNetworks"

 

## Peer AzureUS to AzureUK

## The selecting the US Subscription which contains the virtual network you would like to work with.

Set-AzContext -SubscriptionId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx"

## Select the US Virtual Network and the Resource Group which you would like linking to grant access to the UK domain controller network.
$vNetA=Get-AzVirtualNetwork -Name PublicNetworks -ResourceGroupName PublicNetworks
Add-AzVirtualNetworkPeering `

## Specify the name of the Peering as seen from the US directory tenant
-Name 'AzureUS-to-AzureUK-Peering' `
-VirtualNetwork $vNetA `

## Specify the Resource ID of the remote virtual network within the UK directory tenant.
-RemoteVirtualNetworkId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/resourceGroups/Azure.yourdomain.com/providers/Microsoft.Network/virtualNetworks/Azure.yourdomain.com-vnet"

https://docs.microsoft.com/en-gb/azure/virtual-network/create-peering-different-subscriptions#cli

Correct answer by bikerben on January 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP