Undeployable ARM Template generated
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
Bicep CLI version 0.4.613 (d826ce8411)
**Describe the bug**
The below template compiles successfully, but fails at deployment time with the error "The template function 'reference' is not expected at this location".
This feels like either a code generation issue, or something that should be caught by the type system and produce a compilation error.
**To Reproduce**
```bicep
param webAppName string
resource webApp 'Microsoft.Web/sites@2021-01-01' existing = {
name: webAppName
resource scmCreds 'basicPublishingCredentialsPolicies' = {
name: 'scm'
location: webApp.location
properties: {
allow: false
}
}
}
```
Error
```json
{
"error": {
"code": "InvalidTemplate",
"message": "Deployment template validation failed: 'The template resource 'REDACTED/scm' at line '13' and column '5' is not valid: The template function 'reference' is not expected at this location. Please see https://aka.ms/arm-template-expressions for usage details.. Please see https: //aka.ms/arm-template-expressions for usage details.'.",
"additionalInfo": [
{
"type": "TemplateViolation",
"info": {
"lineNumber": 13,
"linePosition": 5,
"path": "properties.template.resources[0]"
}
}
]
}
}
```
**Additional context**
There is a type issue with the `location` property for `basicPublishingCredentialsPolicies` being missing in the type definitions, so this could be a knock on error from that

Contributor guide
Research direction
Compile the supplied Bicep template with Bicep CLI 0.4.613 and inspect the generated ARM template, focusing on the nested existing basicPublishingCredentialsPolicies resource and its location property. Compare the generated resource structure with ARM template expression rules; done means the example either produces a clear compilation error or deploys successfully without the reference-function validation failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100