Azure / Azure/azure-quickstart-templates
Unable to evaluate template language function 'resourceId': the type 'Microsoft.Compute/virtualMachines/extensions' requires '2' resource name argument
- Dominant language
- Bicep
- Stars
- 14.9k
- Forks
- 16.2k
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 6
Description
My ARM template code fails with the following validation error.
New-azResourceGroupDeployment : 10:41:07 - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The template resource 'DI-XXX-UKW-DB1/joindomain' at line '439' and column '9' is
not valid: Unable to evaluate template language function 'resourceId': the type 'Microsoft.Compute/virtualMachines/extensions' requires '2' resource name argument(s). Please see
https://aka.ms/arm-template-expressions/#resourceid for usage details.. Please see https://aka.ms/arm-template-expressions for usage details.
```
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('varnodeNamePrefix'),copyindex(1),'/extensions')]",
"apiVersion": "2017-03-30",
"location": "[variables('varlocation')]",
"dependsOn": [
"[concat(variables('varnodeNamePrefix'),copyindex(1))]"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.8",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"/sqlcluster/InstallAdditionalModules.ps1"
]
},
"protectedSettings": {
"commandToExecute": "powershell.exe -ExecutionPolicy Unrestricted ./sqlcluster/InstallAdditionalModules.ps1",
"storageAccountName": "fsdfsdfsdf",
"storageAccountKey": "sdfsdfsdfsdfsdfsdfsdf/BH9C+sdfsdfsdfsdfsdfsdfsdf+4K2dEbAnWZ5DZTzPQ=="
}
},
"copy": {
"name": "WinFeatures",
"count":"[variables('varvmCount')]"
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('varnodeNamePrefix'),copyindex(1),'/joindomain')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId(resourceGroup().location,'Microsoft.Compute/virtualMachines/extensions', concat( variables('varnodeNamePrefix'),copyindex(1),'/extensions') ) ]"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "JsonADDomainExtension",
"typeHandlerVersion": "1.3",
"autoUpgradeMinorVersion": true,
"settings": {
"Name": "[variables('vardomainToJoin')]",
"User": "[concat(variables('vardomainToJoin'), '\\', variables('vardomainUsername'))]",
"Restart": "true",
"Options": "[variables('vardomainJoinOptions')]"
},
"protectedSettings": {
"Password": "[variables('vardomainPassword')]"
}
},
"copy": {
"name": "joindomain",
"count":"[variables('varvmCount')]"
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the two Microsoft.Compute/virtualMachines/extensions resource definitions shown in the issue and review the resourceId function usage in the linked ARM template documentation. Compare the dependency expression with the extension resource's nested name structure, then validate the template and confirm deployment validation succeeds without the resourceId argument error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100