Bicep Parameters as Bicep Parameters (and not JSON)
Bicep is the current standard for writing Infrastructure as Code (IaC) for Azure. Bicep replaced ARM Templates (while these templates are still the way to drive the ARM under the hood) but the parameter files remained in JSON format. This has now changed, the .bicepparam file now allows you to write and specify your parameters in a bicep format. Love it.

Bicep is Awesome. Originally started as Project Bicep, it was meant to dodge the limitations and problems that came with ARM templates. For example, ARM templates had a feature called Linked Templates, that was powerful, yet not so convenient. ARM Templates were written in JSON and so string interpolation for example was not possible.

If you want to write your infra as code for Azure, Bicep is your way to go. It is fast, easy to write and maintain, the tooling is awesome, and it will just get you going fast and most of the time right in even one go.

There was some -let’s call it legacy- problem left, parameter files… These files in the ages of ARM Templates have also been written as JSON with the same problems of a lot of ceremony, indentations, and what not to make your parameter files less readable. Well, I’ve got news for you…

Say hi to .bicepparam files

As of today, you can use bicep parameter files. This means you don’t have to write any parameters as JSON anymore. So what does a .bicepparam file look like?

using 'main.bicep'
param pamaterName = 'value'
param objectParameter = {
    property = 'value'
    property2 = 23
}
param arrayParameter = [
    'Value X'
    'Value Y'
]

Als you can see, this parameter file is, like Bicep itself, way more readable because of the lack of ceremony and indentation. It is a straightforward file that just adds values to certain parameters. By binding the .bicepparam file to a specific Bicep file, in the example main.bicep, you’ll get IntelliSense on your way to writing parameter values.

Do you use VS Code?

Creating parameter files from the context menu If you use VS Code, and you have the Bicep extension installed, you can generate parameter files right from VS Code. Right click the Bicep template you want to create a parameter file for and choose Generate Parameters File. You can now select the type of file you want to generate (JSON or bicepparam). And then if you want to include required parameters only, or all parameters.

Also want this feature?

If you also want to work with the new shiny and fancy Bicep param files, you only need to upgrade your bicep runtime. Open a terminal and type:

az bicep upgrade

Et voila, you are good to go. The feature is available as of version 0.18.4 of Bicep. Eager to learn more about Infrastructure as Code for Azure? I have written a book about Infrastucture as Code for Azure available at Amazon and Manning.


Last modified on 2023-06-15

Hi, my name is Eduard Keilholz. I'm a Microsoft developer working at 4DotNet in The Netherlands. I like to speak at conferences about all and nothing, mostly Azure (or other cloud) related topics.