Read and Modify ARM Templates and Bicep Files
30-second answer
An ARM template (JSON) and a Bicep file describe the same thing: the Azure resources you want. Both have parameters (inputs), variables (values worked out once), resources (type, API version, name, location, properties) and outputs. Bicep is shorter and the CLI compiles it to ARM JSON before Azure Resource Manager deploys it. To modify a template, change a parameter's default value or allowed values, add a parameter, or edit a resource's properties, then preview the result with what-if.
Simulate it » No Azure account neededExam objective: 3.1.1 Interpret an Azure Resource Manager template or a Bicep file. 3.1.2 Modify an existing Azure Resource Manager template. 3.1.3 Modify an existing Bicep file. (Skills measured as of April 17, 2026)
Simulations
Feel it before you read it. No account needed, nothing leaves this page.
Contoso's storage template needs a change. Open the <strong>search</strong> bar.
👆 Click the glowing item in the portal to continue
Read the steps as text
- Contoso's storage template needs a change. Open the search bar.
- Type deploy a custom template in the search bar and pick Deploy a custom template under Services.
- On Select a template, choose Build your own template in the editor. You can also start from a quickstart or a template spec your team shares.
- Read it top to bottom. parameters are the inputs, variables are values worked out once, resources is what gets built, outputs come back after deployment. [parameters('skuName')] is an expression that Resource Manager evaluates.
- Modify it: add Standard_ZRS to allowedValues and set it as defaultValue. Then select Save.
- The Basics form is built from the template's parameters. Sku Name is a drop-down because of allowedValues; a value outside the list can't be picked.
- The portal always deploys in Incremental mode. Select Create.
- Done. The deployment is saved in the resource group's Deployments history with the exact template and parameters used.
🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.
🖱️ Drag to rotate · scroll or pinch to zoom
A Bicep file becomes resources
A template has four parts: parameters (inputs such as storageName and skuName), variables (values worked out once), resources (what gets built) and outputs (values handed back). The CLI compiles Bicep to ARM JSON and Azure Resource Manager validates it, then builds it.
🤔 What happens if…
Read this tour as text
- A Bicep file becomes resources. A template has four parts: parameters (inputs such as
storageNameandskuName), variables (values worked out once), resources (what gets built) and outputs (values handed back). The CLI compiles Bicep to ARM JSON and Azure Resource Manager validates it, then builds it. - what-if, Incremental and Complete. what-if previews the changes (
+create,~modify,-delete) without touching anything. Incremental mode, the default, adds and updates. Complete mode also deletes whatever in the resource group isn't in the template. - Export and decompile. Export template (portal, or
az group export) writes what exists now as ARM JSON.az bicep decompileturns JSON into Bicep. Both are starting points: names and values are hard-coded and some properties are missing. - A VM, its host and its size. A VM runs on a physical host in a hardware cluster. Its size (Standard_D2s_v5: D family, 2 vCPUs, premium storage, v5) sets CPU, memory, disk count and price. A resize restarts the VM; a size that isn't on the current cluster needs the VM deallocated first.
- Disks and encryption at host. OS and data disks are managed disks in Azure Storage, encrypted at rest by default. The temp disk and the disk caches live on the host. Encryption at host encrypts those too, end to end; it needs the feature registered and the VM deallocated.
- Move to another resource group or subscription. A move keeps the region and the VM keeps running, but every resource ID changes. The VM must travel with its disks and network interface; across subscriptions the virtual network goes too.
- Move to another region. Azure Resource Mover copies resources to another region: add them, validate dependencies, prepare, initiate move, then commit (or discard) and delete the source.
- Availability sets vs zones. An availability set spreads VMs over fault domains (racks with their own power and network) and update domains in one datacenter: 99.95%. Availability zones spread VMs over separate datacenters: 99.99%. A VM uses one or the other, chosen at creation.
- Scale sets grow on a rule. A Virtual Machine Scale Set (Flexible orchestration recommended) runs identical VMs across zones. Autoscale rules add instances when average CPU is high and remove them when it's low, always between the minimum and maximum.
Contoso keeps its storage accounts in Bicep. Read the file, change its default SKU, preview the change with what-if, deploy it, see what Complete mode would delete, then export the resource group and turn the JSON back into Bicep.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 THE PROBLEM
Someone deployed a storage account with the wrong SKU by hand.
😊 THE SOLUTION
Describe it in a template with parameters and an allowed list.
- Hand-built resources drift✓ One template, same result every time
- Any value goes✓ @allowed and other decorators
- Unreadable JSON✓ Bicep says the same in fewer lines
Start with a question
How do you build the same thing twice and get exactly the same result?
Think of flat-pack furniture. The instructions list the parts, the measurements you can choose (“shelf height: 30, 40 or 50 cm”) and the finished piece. Follow them twice and you get two identical bookcases.
A template is that instruction sheet for Azure. It lists the resources, the choices you’re allowed to make (parameters) and what you get back at the end (outputs). AZ-104 expects you to read one, in ARM JSON or Bicep, and change it without breaking it.
Explain it like I’m 10
The technical explanation
Both formats are declarative: you describe what should exist, not the clicks to make it. Resource Manager compares that with what’s already there and does the rest.
The same storage account in both formats
@minLength(3)
@maxLength(24)
param storageName string
param location string = resourceGroup().location
@allowed([
'Standard_LRS'
'Standard_ZRS'
'Standard_GRS'
])
param skuName string = 'Standard_LRS'
var tags = {
env: 'prod'
owner: 'platform-team'
}
resource st 'Microsoft.Storage/storageAccounts@2023-05-01' = {
name: storageName
location: location
sku: { name: skuName }
kind: 'StorageV2'
tags: tags
}
output blobEndpoint string = st.properties.primaryEndpoints.blob
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageName": { "type": "string", "minLength": 3, "maxLength": 24 },
"location": { "type": "string", "defaultValue": "[resourceGroup().location]" },
"skuName": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [ "Standard_LRS", "Standard_ZRS", "Standard_GRS" ]
}
},
"variables": { "tags": { "env": "prod", "owner": "platform-team" } },
"resources": [{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2023-05-01",
"name": "[parameters('storageName')]",
"location": "[parameters('location')]",
"sku": { "name": "[parameters('skuName')]" },
"kind": "StorageV2",
"tags": "[variables('tags')]"
}],
"outputs": {
"blobEndpoint": { "type": "string", "value": "[reference(parameters('storageName')).primaryEndpoints.blob]" }
}
}
Reading it part by part
| Part | ARM JSON | Bicep | What to look for |
|---|---|---|---|
| Inputs | "parameters": {} | param name type = default | Type, default value, allowed values, min/max length |
| Worked-out values | "variables": {} | var name = … | Values built from parameters, such as names and tags |
| Resources | "resources": [] | resource sym 'type@api' = {} | Type, API version, name, location, SKU, properties |
| Results | "outputs": {} | output name type = … | What the deployment hands back |
| Expressions | "[parameters('x')]" | x | Square brackets mean “evaluate this” in JSON |
| Dependencies | dependsOn | inferred from references | In Bicep, plan.id inside another resource creates the dependency |
A few functions turn up everywhere: resourceGroup().location, uniqueString(resourceGroup().id) for unique names, concat() or Bicep string interpolation 'st${prefix}', and resourceId() in JSON.
Which value wins? A value passed at deployment time (on the command line or in a parameters file) beats the default. No default and no value means validation fails.
Modifying a template safely
The exam shows you a template and asks what to change. The usual edits:
- Allow a new SKU: add it to
allowedValues(JSON) or@allowed(Bicep). ChangedefaultValueor= 'value'if it should become the default. - Make a hard-coded value configurable: add a parameter and replace the literal with
[parameters('x')]orx. - Add a resource: a new entry in
resources(or a newresourceblock) with type, API version, name and location. If it needs another resource, reference it (Bicep) or adddependsOn(JSON). - Protect secrets:
"type": "securestring"in JSON,@secure()in Bicep. The value isn’t logged in deployment history. - Pass values in a file: a JSON parameters file, or a
.bicepparamfile that starts withusing 'main.bicep'.
Watch out for one trap: changing a resource’s name doesn’t rename anything. Resource Manager creates a second resource with the new name and, in the default mode, leaves the old one where it is.
In the portal, Deploy a custom template › Build your own template in the editor lets you paste or load JSON, edit it and see a parameter form built from it. For Bicep, edit the file in VS Code with the Bicep extension or in Cloud Shell’s editor.
Architect level Why Bicep is usually the better file to edit
Bicep removes most of the punctuation and the [ ] expression strings, infers dependsOn from references, and gives you type checking in VS Code before you deploy. Modules (module net 'network.bicep' = { … }) split big deployments into reusable files. Because it compiles to the same JSON, nothing changes for Resource Manager: day-one support for new resource types and API versions applies to both. Keep JSON when another tool generates it or a vendor ships it that way, and use az bicep decompile when you want to take one over.
Real-world business scenario
Contoso Retail (fictional)
- The problem
- Each store team created its own log storage account by hand. Some picked Premium, some forgot TLS 1.2, and nobody could tell which settings were right.
- What they used
- One Bicep file with storageName and skuName parameters, an @allowed list of Standard_LRS, Standard_ZRS and Standard_GRS, a tags variable and minimumTlsVersion set in the resource. When the platform team decided zone redundancy should be the default, they changed one line: param skuName string = 'Standard_ZRS'.
- Why that choice
- Inputs are limited to safe choices, the defaults carry the company's decision, and every account is built from the same reviewed file.
- The result
- New accounts take minutes, none are Premium by accident, and a change to the standard is a one-line pull request.
When to use it and when not to
✓ Use it when…
- You deploy the same kind of resources more than once, such as per store, per team or per environment.
- You want infrastructure changes reviewed like code before they happen.
- You need to know exactly how a resource was configured, months later.
✕ Think twice when…
- A quick test resource you'll delete in an hour. The portal is faster.
- Enforcing rules on people who don't use your template. That needs Azure Policy.
↔ Alternatives to consider
- Azure Policy to enforce allowed SKUs or regions for everyone.
- Template specs to share a reviewed template inside your organisation.
- Terraform if your team already standardises on it across clouds.
Test yourself with exercises
5 original practice questions in the AZ-104 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner What are the main sections of an ARM template?
Model answer
$schema and contentVersion at the top, then parameters, variables, resources and outputs. Functions is optional too. Resources is the only one that does real work: each entry has a type, an apiVersion, a name, a location and its properties.
Intermediate How would you stop people deploying a Premium storage account from your template?
Model answer
I'd restrict the SKU parameter. In ARM JSON that's allowedValues on the parameter, in Bicep it's the @allowed decorator. Resource Manager rejects any other value during validation, before anything is created. If I need it enforced for everyone, not only people using my template, that's an Azure Policy job.
Experienced developer What's the practical difference between a resource's symbolic name and its name in Bicep?
Model answer
The symbolic name, like st, only exists inside the file. I use it to reference the resource, for example st.id or st.properties.primaryEndpoints.blob, and Bicep works out dependsOn for me. The name property is the real Azure resource name that shows up in the portal.
Scenario A colleague hands you a template and says it creates a VM. How do you check what it really does before you run it?
Model answer
I read the parameters to see what I have to supply and what the defaults are, then the resources section for every type it creates, including the NIC, public IP and NSG. Then I run az deployment group what-if against a test resource group, which lists each create, modify and delete without changing anything.
Quick revision
Key points
- Templates are declarative. You describe the end state; Resource Manager works out the steps.
- ARM JSON sections are parameters, variables, resources and outputs (plus $schema and contentVersion).
- Bicep uses param, var, resource and output keywords and compiles to ARM JSON.
- allowedValues (JSON) and @allowed (Bicep) restrict input; validation fails before anything is created.
- ARM expressions live in square brackets, such as [parameters('name')] and [resourceGroup().location].
Important terminology
- ARM template
- A JSON file that declares Azure resources for Azure Resource Manager to deploy.
- Bicep
- A shorter language for the same templates. It compiles to ARM JSON before deployment.
- Parameter
- An input to a template, such as a storage account name or a SKU, supplied at deployment time or taken from a default.
- Variable
- A value worked out once inside the template and reused, such as a tags object.
- Output
- A value the deployment returns, such as an endpoint URL or a resource ID.
- Decorator
- A Bicep annotation on a parameter, such as @allowed, @minLength or @secure.
- Template expression
- In ARM JSON, a value in square brackets that Resource Manager evaluates, such as [parameters('skuName')].
- Symbolic name
- The name you give a resource inside a Bicep file (for example st) so other parts can reference it.
Common mistakes
- Thinking Bicep deploys something different from ARM JSON. It compiles to the same JSON.
- Editing a resource name in a template and expecting Azure to rename the old resource. It creates a new one.
Exam tips
- "Which value will be used?" = the value passed at deployment, otherwise the defaultValue.
- "Only allow certain SKUs in the template" = allowedValues or @allowed.
- "Location of the resource group" = resourceGroup().location.
Five quick revision questions
-
1.Which ARM template section holds the resources to deploy?Show
resources.
-
2.Which Bicep decorator limits a parameter to a list of values?Show
@allowed.
-
3.What does the CLI do with a .bicep file before deployment?Show
It compiles it to an ARM JSON template.
-
4.Which function returns the resource group's region?Show
resourceGroup().location.
-
5.Which Bicep decorator hides a parameter value such as a password?Show
@secure().
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.
Next up: Deploy, Export and Convert Templates to Bicep
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.