Skip to content

Interoperability Bicep to ARM conversion

CARMLPipelinePrincipal edited this page Oct 17, 2023 · 8 revisions

Bicep is ready for production use starting with version 0.3. It is supported by Microsoft support plans and has parity with what can be accomplished with ARM Templates.

However, for users who still prefer using ARM templates over Bicep, the CARML library provides a script that uses the Bicep Toolkit translator/compiler to support the conversion of CARML Bicep modules to ARM/JSON Templates.

This page documents the conversion utility and how to use it.

NOTE: As Bicep & ARM template files work slightly different (e.g., references as specified differently), the ReadMe we generate out of them using the /utilities/tools/Set-Module.ps1 utility may look differently. To this end, make sure to regenerate all ReadMEs after you converted the repository from Bicep to ARM. If you don't, the Pester tests in the pipeline may fail when reviewing the ReadMEs.


Navigation


Location

You can find the script under /utilities/tools/ConvertTo-ARMTemplate.ps1

How it works

The script finds all main.bicep files and converts them to json-based ARM templates by using the following steps:

  1. Remove existing main.json files from folders where main.bicep files are also present.
  2. Convert .bicep files to .json
  3. Remove Bicep metadata from the converted .json files
  4. Remove .bicep files and folders
  5. Update pipeline files - Replace .bicep with .json in pipeline files

How to use it

For details on how to use the function, please refer to the script's local documentation.

Note: The script must be loaded ('dot-sourced') before the function can be invoked.

Clone this wiki locally