I am trying to deploy a storage account arm deployment using visual studio. Below is my template
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountType": {
"type": "array",
"defaultValue": [
"Standard_LRS",
"Standard_LRS",
"Standard_GRS"
]
},
"storageAccountNamePrefix": {
"type": "string",
"defaultValue": "az",
"minLength": 1
}
},
"variables": {
},
"resources": [
{
"name": "[concat(parameters('storageAccountNamePrefix'),'strg', copyIndex(),uniqueString(resourceGroup().id))]",
"type": "Microsoft.Storage/storageAccounts",
"location": "[resourceGroup().location]",
"apiVersion": "2015-06-15",
"copy": {
"count": "[length(parameters('storageAccountType'))]",
"name": "storageCopy"
},
"sku": {
"name": "[parameters('storageAccountType')[copyIndex()]]"
},
"tags": {
"displayName": "[parameters('storageAccountNamePrefix')[copyIndex()]]"
},
"properties": {
"accountType": "[parameters('storageAccountType')[copyIndex()]]"
},
"kind": "Storage"
}
],
"outputs": {
}
}
The error is thrown is at the following line
"name": "[concat(parameters('storageAccountNamePrefix'),'strg', copyIndex(),uniqueString(resourceGroup().id))]",
The error
Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The template resource 'azstrg0u2pzkvcrv3eo4' at line '25' and column '10' is not valid: Template language expression property 'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Templates.Expressions.TemplateFunctionExpression' can't be evaluated. Please see https://aka.ms/arm-template-expressions for usage details..'.
I don't understand why is this failing because I was able to use concat
function in other resource names. I know storage account names can have only characters and numbers no special characters. In the error the resolved name of the resource is accurately displayed. So from the error message it is difficult to know what is wrong with the expression.