2

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
  • 1
    have you tried with `--parameters test.bicepparam` => just removing the `@` – Thomas Jun 27 '23 at 07:37
  • 1
    I agree with @Thomas - your bicep and bicepparam files look fine. The problem is in your command. using `az deployment group create -g innerloop -f .\test.bicep -p .\test.bicepparam` works great for me. – GordonBy Jun 27 '23 at 08:28

1 Answers1

3

[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.

  • You could also add something like that in your answer: the @ symbol is necessary to load json file. In CLI 2.0 it is used to load the contents of the file. It is effectively the same as supplying a JSON string by loading the file. This is from https://github.com/Azure/azure-cli/issues/5899#issuecomment-425998938 – Thomas Jun 27 '23 at 22:53
  • ty, very helpful, and the original error message, so not helpful. :-) – Larry Smith Jul 05 '23 at 22:37