Skip to content

Instantly share code, notes, and snippets.

@MatthewJDavis
Created July 25, 2017 19:11
Show Gist options
  • Save MatthewJDavis/5b3968c304c5a54d12e0ebd539c56ca6 to your computer and use it in GitHub Desktop.
Save MatthewJDavis/5b3968c304c5a54d12e0ebd539c56ca6 to your computer and use it in GitHub Desktop.
Set up VNET peering between ARM and classic vnet
# Set up vnet perring between the classic and ARM vnet
$resourceGroupName = 'domain-services-rg'
$classicVnetName = 'domain-services-vnet'
# Enter the name of the AzureRM subscription the VNETs are deployed in. Run (Get-AzureRmSubscription).SubscriptionName after authenticating to AzureRM
$subScriptionName = ''
# save current vnet in var
$vnet = Get-AzureRmVirtualNetwork -Name northeurope-vnet -ResourceGroupName domain-services-rg
# create the id for the classic vnet - we need the subscription id, resource group name and classic vnet to form the id
$subscriptionId = (Get-AzureRmSubscription -SubscriptionName $subScriptionName).SubscriptionId
$id = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.ClassicNetwork/virtualNetworks/$classicVnetName"
Add-AzureRmVirtualNetworkPeering -Name domain-service-peering -VirtualNetwork $vnet -RemoteVirtualNetworkId $id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment