When attempting to test out referencing a VNet defined in another resource group from my resource template, I get the "resource 'Microsoft.Network/virtualNetworks/other-resourcegroup-vnet' is not defined in a template error". The goal of the test resource template is to create a Nic (similar to how it is done in the documentation for the resourceid() function). A copy of my test template is below.
The target VNet does exist and was created using a resource template. I verified that the VNet was created utilizing the "Microsoft.Network" provider and that I'm referencing that provider in the test template.
Any insight on what I am doing wrong would be greatly appreciated.
Here is the json for my test template:
{"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","parameters": {"other-resourcegroup-vnetLocation": {"type": "string","defaultValue": "South Central US","allowedValues": ["East US","West US","West Europe","East Asia","South Central US","South East Asia" ] },"MyTestNicName": {"type": "string" } },"variables": {"other-resourcegroup-vnetSubnet1Name": "Subnet-1","other-resourcegroup-vnetSubnet2Name": "Subnet-2","VNetResourceGroup": "RDBTestVNet","MyTestNicVnetID": "[resourceId(variables('VNetResourceGroup'),'Microsoft.Network/virtualNetworks', 'other-resourcegroup-vnet')]","MyTestNicSubnetRef": "[concat(variables('MyTestNicVnetID'),'/subnets/', variables('other-resourcegroup-vnetSubnet1Name'))]" },"resources": [ {"name": "[parameters('MyTestNicName')]","type": "Microsoft.Network/networkInterfaces","location": "[parameters('other-resourcegroup-vnetLocation')]","apiVersion": "2015-05-01-preview","dependsOn": ["[concat('Microsoft.Network/virtualNetworks/', 'other-resourcegroup-vnet')]" ],"tags": {"displayName": "MyTestNic" },"properties": {"ipConfigurations": [ {"name": "ipconfig1","properties": {"privateIPAllocationMethod": "Dynamic","subnet": {"id": "[variables('MyTestNicSubnetRef')]" } } } ] } } ],"outputs": { } }