Requires Bicep CLI v0.2.59 or later
The Bicep CLI provides the ability to decompile any existing ARM Template to a .bicep file, using the decompile command:
bicep decompile "path/to/file.json"You can use this command to get to a starting point for Bicep authoring. Note that because there is no guaranteed conversion from JSON to Bicep, decompilation may fail, or you may be left with errors/warnings in the generated Bicep file to fix up. See Limitations for some details of what is not currently possible. Also note that because there is not an exact 1:1 conversion from ARM Template to Bicep, it's possible (and likely) to wind up with different ARM Template code if you go decompile then rebuild(ARM Template --bicep decompile--> Bicep --bicep build--> ARM Template).
You can also use the "Decompile" button in the Bicep Playground
You can pass an exported template directly to the bicep decompile command to effectively export a resource group to a .bicep file.
The following will create a file named main.bicep in the current directory:
az group export --name "your_resource_group_name" > main.json
bicep decompile main.jsonThe following will create a file named main.bicep in the current directory:
Export-AzResourceGroup -ResourceGroupName "your_resource_group_name" -Path ./main.json
bicep decompile main.jsonSee Export Template for guidance. Use bicep decompile <filename> on the downloaded file.
The following are temporary limitations on the bicep decompile command:
- Templates using copy loops cannot be decompiled.
- Nested templates can only be decompiled if they are using 'inner' expression evaluation scope.