Skill 3.1.5
Export a deployment as an Azure Resource Manager template or convert an Azure Resource Manager template to a Bicep file
Key Concepts
The Export template page of a resource group or resource generates a template from the current state of the resources, in JSON or Bicep. It can include or omit parameters, but the result often needs cleaning: some resource types and properties cannot be exported, and values are hard-coded. A deployment on the Deployments page can also be exported, which gives the original template with its parameters exactly as deployed. Exported templates can be saved as template specs for sharing.
az bicep decompile --file main.json converts an ARM JSON template into a Bicep file on a best-effort basis, and the output may need fixes for warnings. az bicep build does the reverse, compiling Bicep to JSON. The Bicep extension in Visual Studio Code can also decompile a JSON file or paste JSON as Bicep.