bicep
bicep copied to clipboard
Deployment doesn't handle default parameter values that are interpolated string expressions
param dataFactoryName string = 'datafactory${uniqueString(resourceGroup().id)}'
param location string = resourceGroup().location
param storageAccountName string = 'storage${uniqueString(resourceGroup().id)}'
param blobContainerName string = 'blob${uniqueString(resourceGroup().id)}'
param managedIdentityName string = 'blob${uniqueString(resourceGroup().id)}'
param _artifactsLocation string = deployment().properties.templateLink.uri
@secure()
param _artifactsLocationSasToken string = ''
output dataFactoryName string = dataFactoryName
output location string = location
output storageAccountName string = storageAccountName
output blobContainerName string = blobContainerName
output managedIdentityName string = managedIdentityName
output _artifactsLocation string = _artifactsLocation
#disable-next-line outputs-should-not-contain-secrets
output _artifactsLocationSasToken string = _artifactsLocationSasToken
- deploy
!) you get asked questions like this:
EXPECTED: Should be asking whether to use the default value as an expression or to enter a specific value (like other expressions) - allow it to create a params file !)
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"_artifactsLocation": {
"value": "none"
},
"dataFactoryName": {
"value": "[format('datafactory{0}', uniqueString(resourceGroup().id))]"
},
"storageAccountName": {
"value": "[format('storage{0}', uniqueString(resourceGroup().id))]"
},
"blobContainerName": {
"value": "[format('blob{0}', uniqueString(resourceGroup().id))]"
},
"managedIdentityName": {
"value": "[format('blob{0}', uniqueString(resourceGroup().id))]"
}
}
}
EXPECTED: Either a new value entered by user or nothing for default
to hack around this, I have started wrapping my strings with string().
param dataFactoryName string = string('datafactory${uniqueString(resourceGroup().id)}')
param location string = resourceGroup().location
param storageAccountName string = string('storage${uniqueString(resourceGroup().id)}')
param blobContainerName string = string('blob${uniqueString(resourceGroup().id)}')
param managedIdentityName string = string('blob${uniqueString(resourceGroup().id)}')
param _artifactsLocation string = deployment().properties.templateLink.uri
@secure()
param _artifactsLocationSasToken string = ''
Same here. VSCode 1.74.3 (Universal) on MacOS, Bicep extension v0.13.1.
The string() workaround works, but I don't want to modify the template's code just to workaround a bug in IDE. I'll use PowerShell until it's fixed.
PS First asked a question on StackOverflow and found this ticket later.