šŸ’ŖARM Templates Or Azure Bicep ā€” What Should I Use?

Dave R - Microsoft Azure MVPā˜ļø
CodeX
Published in
4 min readSep 18, 2021

--

Compare the parity between ARM templates and Azure Bicep.

If youā€™re new to Azure Bicep, this is a new open-source effort to define an Azure-native language for infrastructure as code.

Azure Bicep

ARM templates are not going away, but theyā€™re expressed in JSON format, and for some of us, it might not be a great language for authoring resources in a declarative manner.

Therefore, Microsoft opted to design a new Domain Specific Language (DSL) for deploying Azure resources declaratively from scratch with input from customers.

How complex is Bicep?

Since day one, azure Bicep has been open-source and offers parity with what you can accomplish in ARM templates. While thereā€™s no urgency to switch right away to Bicep, there are some tools available for you to migrate from ARM templates into Bicep templates.

Currently, Azure Bicep supports more than 250 resource types, so you should be able to accomplish everything that youā€™ve been able to achieve with ARM templates. Bicep also includes a CLI to leverage build and decompiling operations.

Think of Bicep as a transparent abstraction for the underlying platform. When you build Bicep templates and perform a deployment operation, it will transpile into an ARM template, and then Resource Manager will go and deploy your resources to Azure.

Yes, there are some alternatives to Bicep like Terraform, Farmer, or Pulumi. However, the main difference, Bicep will transpile into ARM-JSON templates, which is the native notation that Azure understands. The runtime is unchanged; Bicep only provides an abstract layer and reduces the pain of working with JSON.

Clients that work with Azure should have a great authoring experience. While Microsoft has a dedicated team for making the Terraform experience as good as possible, you should explore all the tools available for interacting with Azure that better suits your needs.

I have set some time in the last few months to test Bicep, and it will be a gamechanger for infrastructure as code for Azure; while there are many tools out there, you should pick the tool that works best for you.

What about the learning curve?

You will still have the template functions, the same resource declarations, properties, outputs, and the ability to modularize templates.

I cannot emphasize enough the simplicity of declaring parameters, variables, and resources overall. Bicep files are more concise and easier to read.

If you use Visual Studio Code with the Bicep extension, youā€™ll see that the editor provides rich type-safety, IntelliSense, and syntax validation. However, when decompiling ARM templates into Bicep templates, verifying the output file and refactor as needed is recommended.

If you have previous experience as a developer or with other tools for infrastructure as code, Bicep will be very digestible for you. If you come from the infrastructure side, you will note that Bicep is very intuitive and can get up to speed in a week.

If youā€™re interested in a closer look at Bicep, check the below resources:

Integrations and limitations

While Bicep can be integrated with Azure DevOps and GitHub Actions, it is also important to know some of the current limitations when using Bicep.

In ARM templates, you can author user-defined functions. This is not yet possible in Bicep; hopefully, we will have a fix in the near future.

From the Bicep documentation, I noticed there's no support for the concept of API profile.

After running some tests, there is a limitation when using resource iteration or loops for child resources. To create multiple child resources, you should define the child resources at the top-level resource.

Lastly, the resource iteration for config sources as child resource is not that friendly yet.

Key Takeaways:

Azure Bicep provides a better authoring experience overall, and while it is still in an early stage, we can highlight the following takeaways:

  • Day Zero support for all Azure resource types and API versions.
  • Simpler Syntax.
  • Azure Bicep is Production-Ready, and Microsoft Support will support it 100%.

I hope this article gives you a bit more context on the parity between ARM templates and Azure Bicep and the benefits and current limitations of Bicep.

Join the AzInsider email list here.

-Dave R

--

--