Bicep version
$ az bicep version
Bicep CLI version 0.41.2 (3e403ea7c1)
Describe the bug
When using the @allowed decorator in combination with deployment().location it fails with:
$ az bicep build --file test.bicep
test.bicep(7,7) : Warning no-unused-params: Parameter "location" is declared but never used. [https://aka.ms/bicep/linter-diagnostics#no-unused-params]
test.bicep(7,25) : Error BCP033: Expected a value of type "'eastus2euap' | 'southcentralus'" but the provided value is of type "string". [https://aka.ms/bicep/core-diagnostics#BCP033]
To Reproduce
Contents of test.bicep (minimal reproducible example):
targetScope = 'subscription'
@allowed([
'southcentralus'
'eastus2euap'
])
param location string = deployment().location
Replacing deployment().location with a default hardcoded string (eg. southcentralus) or removing the @allowed decorator, the Bicep file becomes valid.
Bicep version
Describe the bug
When using the
@alloweddecorator in combination withdeployment().locationit fails with:To Reproduce
Contents of
test.bicep(minimal reproducible example):Replacing
deployment().locationwith a default hardcoded string (eg.southcentralus) or removing the@alloweddecorator, the Bicep file becomes valid.