I recently was working on an Azure Resource Manager template and I ran into an issue setting a resource id. I actually had some one assist me in figuring it out, but I figured I share it. I was trying to get the resourceid of the subnet for the nic I was creating. If you look closely you can see I am getting the id of the IPAddresses. I use the resource name and then I add the argument which is the name of the IPAddresses. This is a two segment resource because I am referencing two resources ‘Microsoft.Network/publicIPAddresses’ . Usually with most resources its resourcename,resource value. There are some cases where that is not the case and Subnets are one of them. Subnets use a three segment setup and if you don’t understand that then you get the segment errors. If you look you see that the subnet resourceid uses ‘Microsoft.Network/virtualNetworks/subnets/ which means I have to pass in the subnet name, but I also need the vnet name. SO if there are three segments you have to pass in the values for both resources named. In this case its the VirtualNetworks and Subnet. So if you look at the subnet resource you see the difference between a 2 and 3 segment resource


publicIPAddress”: {
“id”: “[resourceId(‘Microsoft.Network/publicIPAddresses/’, parameters(‘publicIPAddresses_CEBuild_ip_name’))]”
“subnet”: {
“id”: “[resourceId(‘Microsoft.Network/virtualNetworks/subnets/’, parameters(‘virtualNetworks_CloudEngine_RG_vnet_name’), parameters(‘subnets_default_name’))]”


Once I cleared that up with assistance from Stackoverflow 🙂 I started getting another error. Apparently when you are creating the Subnet in the ARM template the name must also be a 3 segment setup. You normally just enter the name of the resource you are creating. In my case I just use the subnet name. I was not aware I needed the vnet name also as part of the actual name. The error pointed me to the line where the subnet was getting created and based on the last fix I decided to try and do the same thing with the name and that fixed it. Like so much with Azure ARM, its a lot of trial and error sometimes.


“comments”: “Generalized from resource: ‘/subscriptions/24b189e9-d338-435f-a60f-3491b68bc8a2/resourceGroups/CloudEngine_RG/providers/Microsoft.Network/virtualNetworks/CloudEngine_RG-vnet/subnets/default’.”,
“type”: “Microsoft.Network/virtualNetworks/subnets”,
name”: “[concat(parameters(‘virtualNetworks_CloudEngine_RG_vnet_name’),’/’, parameters(‘subnets_default_name’))]”,
“apiVersion”: “2017-06-01”,
“scale”: null,
“properties”: {
“provisioningState”: “Succeeded”,
“addressPrefix”: “”
“dependsOn”: [
“[resourceId(‘Microsoft.Network/virtualNetworks’, parameters(‘virtualNetworks_CloudEngine_RG_vnet_name’))]”