Microsoft Azure Administrator (AZ-104) · Section 3 · 23% of the exam
Export a deployment as an Azure Resource Manager template or convert an Azure Resource Manager template to a Bicep file
One of the objectives of the Microsoft Azure Administrator (AZ-104) exam, in the section “Deploy and manage Azure compute resources”. Here is what it covers, the points to remember and a question to try.
What it covers
Deployment sends a template to Resource Manager at a chosen scope in incremental or complete mode, and what-if previews the result first. Export saves a template from a resource group or from deployment history, and decompile turns exported JSON into Bicep.
Points to remember
- Deploy with
az deployment group|sub|mg|tenant createor the matching New-Az...Deployment cmdlet; non-group scopes need--location. - Incremental mode (default) leaves extra resources alone; complete mode deletes resources not in the file and is not recommended.
- Run what-if first: change types are Create, Delete, Modify, NoChange, Ignore and Deploy.
- Pass parameters inline, with a JSON parameters file or with a
.bicepparamfile (do not add --template-file with a .bicepparam). - Export from a resource group gives a snapshot of current state; export from deployment history gives the exact template that was deployed.
Try a question
You exported the template of a resource group and saved it as main.json. You want to continue maintaining it as Bicep. Which command creates main.bicep from the file?
- Aaz bicep decompile --file main.json
- Baz bicep build --file main.json
- Caz bicep upgrade --file main.json
- Daz deployment group create --template-file main.json --output bicep
Show the answer
A. az bicep decompile --file main.json creates main.bicep in the same folder, and --force overwrites an existing file. Decompilation is best effort, so review the output and fix warnings, names and API versions. Running bicep decompile main.json does the same without the Azure CLI.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson Deploying, exporting and converting templates teaches this objective (about 45 minutes), and 11 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.
More in this section
- Interpret an Azure Resource Manager template or a Bicep file
- Modify an existing Azure Resource Manager template
- Modify an existing Bicep file
- Deploy resources by using an Azure Resource Manager template or a Bicep file
- Create a virtual machine
- Configure Azure Disk Encryption
- Move a virtual machine to another resource group, subscription, or region
- Manage virtual machine sizes
- Manage virtual machine disks
- Deploy virtual machines to availability zones and availability sets
- Deploy and configure an Azure Virtual Machine Scale Sets
- Create and manage an Azure container registry