Created
July 25, 2017 19:11
-
-
Save MatthewJDavis/5b3968c304c5a54d12e0ebd539c56ca6 to your computer and use it in GitHub Desktop.
Set up VNET peering between ARM and classic vnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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