AZ-104 Question 127
Single answerYour organization has deployed a set of Azure resources using the Azure Portal for a new project. You need to replicate the same infrastructure setup across multiple environments. Leadership has asked you to provide both an ARM template and a Bicep file for the existing deployment. Which approach should you take to achieve this with minimal effort?
- A
Navigate to the resource group's Deployments blade, select the desired deployment, export the template, and use 'bicep decompile' on the downloaded JSON file.
- B
Create a new Bicep file from scratch by manually typing each resource definition and then generate an ARM template using an Azure CLI command.
- C
Use the Azure CLI command 'az bicep convert' directly on the existing live resources without downloading any template files.
- D
Export the entire resource group to a PowerShell script in the Azure Portal and then manually translate the script into a JSON template.
Show answer and explanation
Correct answer: A
Explanation
Exporting the template from the existing deployment and using the 'bicep decompile' command afterward provides a straightforward workflow. Azure natively allows you to export a JSON-based template from the resource group's deployment history. Once you have the JSON file, the Bicep CLI can convert it into a Bicep file, making it easier to maintain and reuse the infrastructure definition.
- A. Correct.
Exporting the template from the Deployments blade and then running 'bicep decompile' is the recommended and easiest approach to generate both the ARM template (already provided by Azure) and a Bicep file.
- B. Incorrect.
Manually creating a new Bicep file from scratch might be time-consuming and prone to errors; it's more efficient to convert an existing template than to author everything from the ground up.
- C. Incorrect.
There is no 'az bicep convert' command that can convert live Azure resources directly into Bicep without going through an ARM template file first.
- D. Incorrect.
Exporting a resource group as a PowerShell script in the Portal is possible, but it does not automatically yield a JSON ARM template that can be easily converted to a Bicep file.