AZ-104 Question 128
Single answerYou are an Azure Administrator at Contoso. You have an existing resource group with a web app and a storage account deployed through the Azure portal. Your DevOps team needs to replicate these resources in another subscription and manage them as Infrastructure as Code. Which approach best allows you to export the current deployment as an ARM template and then convert it to a Bicep file for future use?
- A
Export the deployment as a template from the Azure portal, then run 'az bicep decompile' to generate the Bicep file.
- B
Use Azure Resource Graph Explorer to automatically generate a Bicep file from existing deployments.
- C
Run 'bicep build' on the existing live deployment to create a Bicep file without needing an ARM template.
- D
Manually recreate the resources within a new Bicep file by inspecting settings in the Azure portal.
Show answer and explanation
Correct answer: A
Explanation
To easily manage and replicate a deployed environment, you can export an existing deployment as an ARM template and then convert that JSON template into a Bicep file using 'az bicep decompile'. This preserves the resource definitions and provides a straightforward path to adopt Infrastructure as Code practices.
- A. Correct.
Exporting from the portal provides an ARM template JSON file, and the 'az bicep decompile' command in Azure CLI converts that JSON into a Bicep file.
- B. Incorrect.
Azure Resource Graph is useful for querying resources, but it does not convert them into Bicep templates automatically.
- C. Incorrect.
'bicep build' generates ARM templates (JSON) from existing Bicep files, not the other way around, so it won't directly create a Bicep file from a live deployment.
- D. Incorrect.
Manually recreating resources by hand is time-consuming and prone to errors, and does not leverage the export or decompile tooling.