"This symbol cannot be referenced here. Only other parameters can be referenced in parameter default values."
It means that the resourceID
value cannot be referenced directly with the default value in Arm templates
. Instead of passing it directly, Use reference
function to pass the resource ID in the default value parameters
.
I created a subnets
in virtual networks by referencing it with a default value and was able to deploy it successfully.
I've taken a sample template to create a subnet within a virtual network from MSDoc and I modified the below script in json
file:
"parameters": {
"location": {
"type": "string",
"defaultValue": "Westus",
},
"subnets": {
"type": "string",
"defaultValue": "[reference('Microsoft.Network/virtualNetworks/subnets', myvn, 'subnet1').id]"
}
}
Output:

Deployment succeeded and created in Portal:
