Search code examples
azureazure-resource-managerazure-bicep

Cannot use bicepparam file in Azure deployment


I am trying to use a .bicepparam parameter file in my Azure CLI deployment and I get an error of unrecognized template parameter 'using './test.bicep'. My deployment does work if I use a traditional ARM parameter JSON file.

Is this a problem with my syntax or is this a bug? It's almost as if the Azure CLI isn't aware of bicepparam files. I haven't seen anyone else with this problem other than one person for GitHub issue 111296 I created regarding the Bicep parameter file documentation, so it's very possible it's some syntax problem on my end.

Below is my test Bicep template, Bicep parameter file, and the command I used. I am trying this on macOS, but I also have this problem when using Windows 11. I expect this template to return JSON showing the output for combinedValue to be Hello World!'. Here is additional information.

  • macOS Ventura 13.4.1
  • Azure CLI 2.49.0
  • Azure CLI Bicep 0.18.4

test.bicep

param value1 string
param value2 string

output combinedValue string = '${value1} ${value2}'

test.bicepparam

using './test.bicep'

param value1 = 'Hello'
param value2 = 'World!'

Command (zsh)

% az deployment group create --name test --resource-group test-resouce-group --template-file test.bicep --parameters @test.bicepparam
unrecognized template parameter 'using './test.bicep'

param value1 '. Allowed parameters: value1, value2

Solution

  • [This was answered by @Thomas and @GordonBy in the comments.]

    The @parameters.json syntax is not used when deploying a .bicepparam file with Azure CLI. Instead, just specify the filename as so:

    % az deployment group create --name test --resource-group test-resouce-group --template-file test.bicep --parameters test.bicepparam
    

    This is different from a traditional JSON ARM parameter file, where you do use the @ symbol before the filename. As per Thomas' comment below, the @ symbol loads the contents of the file, so it's effectively the same as typing the inline parameters on the CLI. Since that's not what we want to do with a .bicepparam file, we don't need use the @ symbol.