Is there a way to add a resourceid as a parameter ?
param ftports array = [
{
name: 'test'
value_id:resourceId('Microsoft.Network/virtualNetworks/subnets', myVNet_name, 'mySubnet')
}
]
can’t get rid of the error "This symbol cannot be referenced here. Only other parameters can be referenced in parameter default values."
2
Answers
I never tried your scenario but you can reference the existing subnet and then use its values:
It means that the
resourceID
value cannot be referenced directly with the default value inArm templates
. Instead of passing it directly, Usereference
function to pass the resource ID in the default valueparameters
.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:Output:
Deployment succeeded and created in Portal: