Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 2.01 KB

decompiling.md

File metadata and controls

37 lines (28 loc) · 2.01 KB

Decompiling an ARM Template

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

Exporting a resource group

You can pass an exported template directly to the bicep decompile command to effectively export a resource group to a .bicep file.

Azure CLI

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.json

Azure PowerShell

The 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.json

Azure Portal

See Export Template for guidance. Use bicep decompile <filename> on the downloaded file.

Current Limitations

The following are temporary limitations on the bicep decompile command: