First glance at upcoming Bicep parameter files!

First glance at upcoming Bicep parameter files!

It's probably the most heard question whenever I provide a talk on Bicep and dive into deploying Bicep files and the options to provide parameters:

"Why is the parameters file you use while deploying a Bicep template to Azure still of type JSON?"

A very valid question, and this is about to change! Beyond all of the awesome extra capabilities that Bicep provides compared to ARM Templates (based on JSON), a big benefit of Bicep is also the simplified syntax. Compared to ARM Templates, Bicep templates are much easier to read, author, debug and digest.

But for the parameter files, you still need to revert to JSON. Today, the Bicep integration in VSCode and Visual Studio code provides options to generate a parameters files based on your Bicep files. Simply right click and select 'Generate Parameters File' as shown below.

No alt text provided for this image
VSCode option Generate Bicep Parameters File

The parameters file that is generated is of type JSON and looks like below. If you've worked with ARM templates in the past, this is the exact same parameters file we're all used to.

No alt text provided for this image

This is about to change! We're close to the release of an feature that introduces Bicep parameters files. These are not based on JSON anymore, have the extension .bicepparam, and provide the same clean syntax we all love about Bicep!

Today, the feature is still in experimental phase, so if you want to test it prior to release, make sure you allow the experimental feature 'paramsFiles' inside your bicepconfig file.

Let's consider the following straightforward Bicep file which deploys an Azure Virtual Desktop host pool.

No alt text provided for this image

Below is what the corresponding .bicepparam file looks like.

No alt text provided for this image

Super clean, much less in terms of lines of code, and all of the complex syntax overhead is removed! I love it! Also note that a new keyword is introduced called 'using', here you specify the corresponding bicep template. As a result of that you also get the code completions and suggestions inside your .bicepparam files. For example when a parameter is missing inside your .bicepparam, the VSCode integration knows about this and you get the following error

No alt text provided for this image

And of course the Bicep language integration inside VSCode and Visual Studio code helps you fix this in no time!

No alt text provided for this image

Bicep parameters files are expected to become available soon as part of version 0.18! Once available I'll share more details and options like for example the ability to generate a .bicepparam file from your Bicep file, VSCode deploy and much more!

Looking to get started with Bicep? I authored and published the book Getting started with Bicep: Infrastructure as code on Azure

p.s. I love the Microsoft AI Image creator, it created the header for this post in seconds!

Mee-Lian R.

Software Engineer at DutchWorkz BV

1 年

Does it work with the value from the variables-group of Azure DevOps especially secrets?

回复
Marcel E.

Cloud Architect

1 年

Finally! Thanks for the info Freek Berson

Freek Berson

Empowering hybrid and remote workforces with a digital workspace from any device, anywhere. EUC Enthusiast, Microsoft MVP, ?? public speaker, ?? Author. #Parallels #Alludo #AVD #RDS #Bicep ?? #Automation

1 年
  • 该图片无替代文字

要查看或添加评论,请登录

Freek Berson的更多文章

社区洞察

其他会员也浏览了