farmer icon indicating copy to clipboard operation
farmer copied to clipboard

Seems as if remote vnet peering for virtual networks does not support the remote vnet being in a different resource group

Open thinkdavid opened this issue 6 months ago • 1 comments

Creating a virtual network peering requires two resources to be deployed. A peering resource on the remote must be created as well as the initial network.

for example:

{
      "apiVersion": "2020-05-01",
      "dependsOn": [
        "[resourceId('Microsoft.Network/virtualNetworks', 'tnt45-svcs-p30-westcentralus-fleet-vnet')]"
      ],
      "location": "westeurope",
      "name": "tnt45-svcs-p30-westcentralus-fleet-vnet/peering-tnt45-mgmt-p30-westcentralus-vnet",
      "properties": {
        "allowForwardedTraffic": true,
        "allowGatewayTransit": false,
        "allowVirtualNetworkAccess": true,
        "remoteVirtualNetwork": {
          "id": "[resourceId('d6d55a90-6c37-42aa-a68b-00a3658d0a2f', 'tnt45-mgmt-p30-westcentralus', 'Microsoft.Network/virtualNetworks', 'tnt45-mgmt-p30-westcentralus-vnet')]"
        },
        "useRemoteGateways": false
      },
      "type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings"
    },
    {
      "apiVersion": "2020-05-01",
      "dependsOn": [
        "[resourceId('Microsoft.Network/virtualNetworks', 'tnt45-svcs-p30-westcentralus-fleet-vnet')]"
      ],
      "location": "westeurope",
      "name": "tnt45-mgmt-p30-westcentralus-vnet/peering-tnt45-svcs-p30-westcentralus-fleet-vnet",
      "properties": {
        "allowForwardedTraffic": true,
        "allowGatewayTransit": false,
        "allowVirtualNetworkAccess": true,
        "remoteVirtualNetwork": {
          "id": "[resourceId('Microsoft.Network/virtualNetworks', 'tnt45-svcs-p30-westcentralus-fleet-vnet')]"
        },
        "useRemoteGateways": false
      },
      "type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings"
    }

The first resource in the example deploys successfully, but the second doesn't with an ARM resource not found exception. I believe this is due to it being in a different resource group, and so I think it cannot be part of the same template.

thinkdavid avatar Dec 23 '23 01:12 thinkdavid

One for @ninjarobot I think!

isaacabraham avatar Jan 05 '24 13:01 isaacabraham