AZ-104 Question 129
Select 2You have deployed several Azure resources, including a virtual machine, storage account, and virtual network, through the Azure portal. You now want to replicate this setup in another subscription. To ensure you can manage and modify the configuration as code, you decide to export the template of the current deployment and then convert it into a Bicep file. Which two actions are required for this process?
- A
Open the resource group's Export template option in the Azure portal, download the generated JSON template file, and save it locally
- B
Directly select Export to Bicep from the resource group's settings in the Azure portal to generate a Bicep file
- C
Use the Azure CLI command 'az bicep decompile --file <exportedTemplate.json>' to convert the downloaded ARM template to a Bicep file
- D
Edit the downloaded JSON file manually to insert valid Bicep DSL syntax and rename it with a .bicep extension
Show answer and explanation
Correct answers: A, C
Explanation
To export an existing deployment as an ARM template, use the 'Export template' feature in the Azure portal. This generates a JSON file that describes your resource configuration. Afterwards, use the 'az bicep decompile' CLI command to convert the downloaded JSON file into a Bicep file, ensuring you have a clean Bicep configuration ready for future deployments.
- A. Correct.
You can export the existing deployment as a JSON-based ARM template from the Azure portal by selecting 'Export template' and downloading the file
- B. Incorrect.
There is no direct 'Export to Bicep' option available in the Azure portal; you must export to ARM JSON first
- C. Correct.
You should use the Azure CLI bicep 'decompile' command to convert an existing ARM JSON template into a Bicep file
- D. Incorrect.
Manually editing a JSON template to insert Bicep DSL syntax is not required or recommended; the bicep CLI can automatically convert JSON to Bicep