Azure Resource Template: language expression is not supported

3.8k views Asked by At

I'm creating an Azure resource template and getting this validation error when I specify tags:

New-AzureResourceGroupDeployment : Error 1: Code=InvalidTemplate; Message=Deployment template validation failed: 'The template resource 'hosting-plan' at line '86' and column '10' is not valid: Template language expression '[parameters('intranetConnectivity')]' is not supported..'.

Here's the relevant section of the template:

"parameters": {
    "intranetConnectivity": {
        "type": "bool",
        "defaultValue": false
    },
    ...
}

"name": "[parameters('siteName')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('siteLocation')]",
"tags": {
    "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
    "ServiceModel": "[parameters('serviceModel')]",
    "IntranetConnectivity": "[parameters('intranetConnectivity')]",
    "Environment": "[parameters('environment')]"
},

I thought maybe the parameter name was too long, but I get the same error regardless of the parameter name.

2

There are 2 answers

1
BenV On BEST ANSWER

It turned out that it didn't like me using a boolean parameter in a string value. I changed the parameter definition to string and everything works.

"intranetConnectivity": {
    "type": "string",
       "allowedValues": [
           "true",
           "false"
       ],
    "defaultValue": "false"
},
0
DreadedFrost On

Just to clarify Tags only support string values, not anything else. Check the limitations

  • Not all resource types support tags. To determine if you can apply a tag to a resource type, see Tag support for Azure resources.

  • Each resource or resource group can have a maximum of 50 tag name/value pairs. If you need to apply more tags than the maximum allowed number, use a JSON string for the tag value. The JSON string can contain many values that are applied to a single tag name. A resource group can contain many resources that each have 50 tag name/value pairs.

  • The tag name is limited to 512 characters, and the tag value is limited to 256 characters. For storage accounts, the tag name is limited to 128 characters, and the tag value is limited to 256 characters.

  • Generalized VMs don't support tags.

  • Tags applied to the resource group are not inherited by the resources in that resource group.

  • Tags can't be applied to classic resources such as Cloud Services.

  • Tag names can't contain these characters: <, >, %, &, \, ?, /