Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Lesson 20 of 47
❮Prev Next❯

Read and Modify ARM Templates and Bicep Files

Module 3: Compute ⏱ 11 min read Updated

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    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 needed

    Exam 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.

    Azure portal: Read and modify a template in the portal editor Read a template in the editor, change a parameter and deploy it.
    </> Embed

    Embed this simulation

    Free for trainers, teachers and bloggers. Paste this into your page:

    Loading the portal…

    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
    1. Contoso's storage template needs a change. Open the search bar.
    2. Type deploy a custom template in the search bar and pick Deploy a custom template under Services.
    3. 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.
    4. 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.
    5. Modify it: add Standard_ZRS to allowedValues and set it as defaultValue. Then select Save.
    6. 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.
    7. The portal always deploys in Incremental mode. Select Create.
    8. 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.

    😟 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
    🛠️ Solved with: ARM templates and Bicep

    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

    PartARM JSONBicepWhat to look for
    Inputs"parameters": {}param name type = defaultType, 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')]"xSquare brackets mean “evaluate this” in JSON
    DependenciesdependsOninferred from referencesIn 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). Change defaultValue or = 'value' if it should become the default.
    • Make a hard-coded value configurable: add a parameter and replace the literal with [parameters('x')] or x.
    • Add a resource: a new entry in resources (or a new resource block) with type, API version, name and location. If it needs another resource, reference it (Bicep) or add dependsOn (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 .bicepparam file that starts with using '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

    Retail

    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.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    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.

    Question 1

    Question 1 of 5

    An ARM template contains a parameter named skuName with a defaultValue of Standard_LRS and allowedValues of Standard_LRS and Standard_GRS. You deploy the template and pass skuName=Standard_GRS on the command line.

    Which SKU is used for the storage account?

    Question 2

    Question 2 of 5

    An ARM template sets the location of a resource to [resourceGroup().location]. You deploy the template to a resource group in West Europe while your Cloud Shell session runs in East US. Where is the resource created?

    Question 3

    Question 3 of 5

    An ARM template defines a skuName parameter with allowedValues of Standard_LRS and Standard_GRS. Administrators must be able to deploy storage accounts that use Standard_ZRS. The default must remain Standard_LRS.

    What should you modify in the template?

    Question 4

    Question 4 of 5 · Select 2

    You maintain a Bicep file that deploys a virtual machine. The admin password is currently passed as a plain string parameter, and the VM size is hard-coded as 'Standard_D2s_v5' in the resource.

    Which two changes should you make so that the password is not shown in deployment history and administrators can choose the VM size at deployment time? Each correct answer presents part of the solution.

    Question 5

    Question 5 of 5

    A Bicep file contains the following line: resource st 'Microsoft.Storage/storageAccounts@2023-05-01' = { name: storageName ... }. Another resource in the same file references st.id. What does st represent?

    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. 1.Which ARM template section holds the resources to deploy?Show

      resources.

    2. 2.Which Bicep decorator limits a parameter to a list of values?Show

      @allowed.

    3. 3.What does the CLI do with a .bicep file before deployment?Show

      It compiles it to an ARM JSON template.

    4. 4.Which function returns the resource group's region?Show

      resourceGroup().location.

    5. 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

    Studying with a friend? Send them this lesson

    It's free and needs no sign-up. Their progress saves in their own browser.

    Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

    One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.