Azure / Azure/azure-quickstart-templates

Unable to use reference() inside Microsoft.Web/sites/{site}/config/web properties

Open
#2,253 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Bicep
Stars
14.9k
Forks
16.2k
Avg merge
6d 21h
Merged PRs (30d)
6

Description

I am trying to set `alwaysOn` for a web app based on whether the app service plan is in a tier that supports it. The `reference()` call below fails when it is inside the `properties` (see below). If I move this `reference()` call into an output parameter it succeeds. Am I missing something or doing something wrong? Thanks!

``` javascript
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0",
"parameters": {
"name": {
"type": "string",
"metadata": {
"description": "name of the resource"
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "location of the resource"
}
},
"appServicePlan": {
"type": "string",
"metadata": {
"description": "app service plan to create the web app on"
}
}
},
"variables": {
"apiVersion": "2016-03-01",
"convertToAlwaysOn": {
"F": false,
"B": false,
"S": true,
"P": true
}
},
"resources": [
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Web/sites",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"properties": {
"name": "[parameters('name')]",
"serverFarmId": "[parameters('appServicePlan')]"
},
"resources": [
{
"apiVersion": "[variables('apiVersion')]",
"type": "config",
"name": "web",
"dependsOn": ["[resourceId('Microsoft.Web/sites', parameters('name'))]"],
"properties": {
"alwaysOn": "[variables('convertToAlwaysOn')[toUpper(substring(reference(resourceId('Microsoft.Web/sites', parameters('name'))).sku, 0, 1))]]"
}
}
]
}
]
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the supplied deployment template in Azure, starting with the nested Microsoft.Web/sites/config/web resource and its reference() expression. Compare evaluation inside properties with the output case described in the issue. Done means documenting whether this usage is supported and, if not, recording the supported limitation or required template adjustment.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, json
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.