Please help me understand what is wrong with my Azure ARM template here, Which is very basic, takes some input arguments and prints out resourceId.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualNetworkName": {
"type": "string"
},
"virtualNetworkResourceGroupName": {
"type": "string"
},
"subnetName": {
"type": "string"
},
"location": {
"type": "string",
"metadata": {
"description": "Location to Deploy Azure Resources"
}
}
},
"resources": [],
"outputs": {
"subnetRef": {
"type": "string",
"value": "[resourceId(parameters('virtualNetworkResourceGroupName'), 'Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), parameters('subnetName'))]"
}
}
}
Providing the required parameters, it fails with the following Error Message.
Parameter File
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualNetworkName": {
"value": "core-services-vnet"
},
"virtualNetworkResourceGroupName": {
"value": "core-networking-rg"
},
"subnetName": {
"value": "private"
},
"location": {
"value": "westus"
}
}
}
$ az deployment create -n core-deploy --template-file azuredeploy.json --parameters @params.json --location westus
Deployment failed. Correlation ID: b97a7544-2814-40c0-88c9-fbaaea2bf645. The template output 'subnetRef' is not valid: The provided value 'core-networking-rg' is not valid subscription identifier. Please see https://aka.ms/arm-template-expressions/#resourceid for usage details.
What Am I missing here ?
Thanks, Nag
myResource-rg
? Sounds like the most likely problem – James