Forum Discussion

nirmalmcse02's avatar
nirmalmcse02
Copper Contributor
Oct 12, 2020
Solved

ARM template for existing Vnet Peering

Hi All,

 Is there any ARM template available for establishing VNET Peering for two existing Virtual Network. 

I am referring below GitHub template. However it is creating one side peering only not vise versa. 

https://github.com/Azure/azure-quickstart-templates/tree/master/201-existing-vnet-to-vnet-peering

  • nirmalmcse02 Hi, if you copy this resource change relevant parameters to the peer that is missing. 

     

    These changes will allow you to create the missing peer. (Remember to change resource name below to something different than what it is currently or naming conflict will appear)

     

    {
          "apiVersion": "2019-11-01",
          "type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings",
          "name": "[concat(parameters('existingLocalVirtualNetworkName'), '/peering-to-remote-vnet')]",
          "location": "[parameters('location')]",
          "properties": {
            "allowVirtualNetworkAccess": true,
            "allowForwardedTraffic": false,
            "allowGatewayTransit": false,
            "useRemoteGateways": false,
            "remoteVirtualNetwork": {
              "id": "[resourceId(parameters('existingRemoteVirtualNetworkResourceGroupName'), 'Microsoft.Network/virtualNetworks', parameters('existingRemoteVirtualNetworkName'))]"
            }
          }
        }

     

1 Reply

  • tamstar1234's avatar
    tamstar1234
    Copper Contributor

    nirmalmcse02 Hi, if you copy this resource change relevant parameters to the peer that is missing. 

     

    These changes will allow you to create the missing peer. (Remember to change resource name below to something different than what it is currently or naming conflict will appear)

     

    {
          "apiVersion": "2019-11-01",
          "type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings",
          "name": "[concat(parameters('existingLocalVirtualNetworkName'), '/peering-to-remote-vnet')]",
          "location": "[parameters('location')]",
          "properties": {
            "allowVirtualNetworkAccess": true,
            "allowForwardedTraffic": false,
            "allowGatewayTransit": false,
            "useRemoteGateways": false,
            "remoteVirtualNetwork": {
              "id": "[resourceId(parameters('existingRemoteVirtualNetworkResourceGroupName'), 'Microsoft.Network/virtualNetworks', parameters('existingRemoteVirtualNetworkName'))]"
            }
          }
        }

     

Resources