Bird
Raised Fist0
Azurecloud~10 mins

ARM template structure in Azure - Step-by-Step Execution

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Process Flow - ARM template structure
Start ARM Template
Define $schema
Set contentVersion
Declare parameters
Declare variables
Define resources
Declare outputs
End Template
The ARM template starts with schema and version, then defines parameters, variables, resources, and outputs in order.
Execution Sample
Azure
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {},
  "variables": {},
  "resources": [],
  "outputs": {}
}
This is a minimal ARM template structure showing all main sections.
Process Table
StepSection ProcessedActionResult
1$schemaRead and validate schema URLTemplate schema set for ARM validation
2contentVersionRead version stringTemplate version set to 1.0.0.0
3parametersParse parameters objectParameters ready for input values
4variablesParse variables objectVariables ready for internal use
5resourcesParse resources arrayResources defined for deployment
6outputsParse outputs objectOutputs defined for deployment results
7EndComplete parsingTemplate ready for deployment
💡 All sections processed; template structure is valid and ready for deployment
Status Tracker
SectionStartAfter Processing
$schemaNot sethttps://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#
contentVersionNot set1.0.0.0
parametersEmpty{}
variablesEmpty{}
resourcesEmpty[]
outputsEmpty{}
Key Moments - 3 Insights
Why is the $schema property important in an ARM template?
The $schema property tells Azure how to validate the template structure and syntax. Without it, Azure cannot confirm the template is correct (see execution_table step 1).
Can the resources section be empty in a valid ARM template?
Yes, the resources array can be empty if no resources are being deployed, but the template still needs to include it (see execution_table step 5).
What is the purpose of the outputs section?
Outputs provide information back after deployment, like resource IDs or connection strings. They are optional but useful (see execution_table step 6).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the result after processing the parameters section?
AResources defined for deployment
BTemplate version set to 1.0.0.0
CParameters ready for input values
DOutputs defined for deployment results
💡 Hint
Check execution_table row with Section Processed 'parameters'
At which step does the ARM template finish parsing all sections?
AStep 5
BStep 7
CStep 6
DStep 4
💡 Hint
Look for the row with Section Processed 'End' in execution_table
If the variables section is removed, which part of the variable_tracker would change?
AThe variables row value
BThe $schema value
CThe outputs row value
DThe resources row value
💡 Hint
Check variable_tracker row for 'variables' section
Concept Snapshot
ARM Template Structure:
- $schema: URL for template validation
- contentVersion: template version
- parameters: inputs for deployment
- variables: internal values
- resources: Azure resources to create
- outputs: values returned after deployment
All sections must be valid JSON objects or arrays.
Full Transcript
An ARM template is a JSON file that defines Azure resources to deploy. It starts with a $schema property that tells Azure how to validate the template. Then it has a contentVersion to track template version. Parameters allow users to input values when deploying. Variables store internal values used in the template. Resources define what Azure services to create or configure. Outputs return information after deployment. Each section is processed in order, and the template must be valid JSON to deploy successfully.

Practice

(1/5)
1. Which section in an ARM template is used to define the Azure resources you want to create?
easy
A. outputs
B. parameters
C. resources
D. variables

Solution

  1. Step 1: Understand ARM template sections

    An ARM template has sections like parameters, variables, resources, and outputs.
  2. Step 2: Identify the section for Azure resources

    The 'resources' section lists the Azure services and components to create.
  3. Final Answer:

    resources -> Option C
  4. Quick Check:

    Resources section defines Azure resources [OK]
Hint: Resources section always holds Azure resource definitions [OK]
Common Mistakes:
  • Confusing parameters with resources
  • Thinking variables define resources
  • Mixing outputs with resource definitions
2. Which of the following is the correct way to start an ARM template JSON file?
easy
A. { "parameters": { }, "variables": { }, "resources": [ ] }
B. [ "parameters", "variables", "resources" ]
C.
D. parameters: {}, variables: {}, resources: []

Solution

  1. Step 1: Recognize ARM template format

    ARM templates are JSON files with keys like parameters, variables, and resources.
  2. Step 2: Check JSON syntax correctness

    { "parameters": { }, "variables": { }, "resources": [ ] } uses valid JSON object syntax with keys and empty objects/arrays.
  3. Final Answer:

    { "parameters": { }, "variables": { }, "resources": [ ] } -> Option A
  4. Quick Check:

    ARM templates start with JSON objects [OK]
Hint: ARM templates are JSON objects with keys, not arrays or XML [OK]
Common Mistakes:
  • Using array brackets instead of object braces
  • Writing XML tags instead of JSON
  • Omitting quotes around keys
3. Given this ARM template snippet:
{ "parameters": { "vmName": { "type": "string" } }, "variables": { "location": "eastus" }, "resources": [ { "type": "Microsoft.Compute/virtualMachines", "name": "[parameters('vmName')]", "location": "[variables('location')]" } ] }

What will be the location of the virtual machine if the parameter vmName is set to "MyVM"?
medium
A. MyVM
B. westus
C. undefined
D. eastus

Solution

  1. Step 1: Identify location value in variables

    The variable 'location' is set to "eastus" in the variables section.
  2. Step 2: Understand resource location assignment

    The VM's location uses the variable 'location', so it will be "eastus" regardless of vmName.
  3. Final Answer:

    eastus -> Option D
  4. Quick Check:

    Location comes from variables, not parameters [OK]
Hint: Resource location uses variables, not parameters [OK]
Common Mistakes:
  • Confusing vmName parameter with location
  • Assuming location is from parameters
  • Ignoring variable usage syntax
4. Identify the error in this ARM template snippet:
{ "parameters": { "storageName": { "type": "string" } }, "resources": [ { "type": "Microsoft.Storage/storageAccounts", "name": "storageName", "location": "eastus" } ] }
medium
A. The location value must be a variable, not a string
B. The resource name should use parameter syntax with brackets
C. Parameters section cannot be empty
D. Resource type is invalid

Solution

  1. Step 1: Check resource name usage

    The resource name is set as "storageName" string, but it should reference the parameter.
  2. Step 2: Correct parameter reference syntax

    Parameters are referenced with "[parameters('storageName')]" to use the parameter value.
  3. Final Answer:

    The resource name should use parameter syntax with brackets -> Option B
  4. Quick Check:

    Parameter references need brackets and function call [OK]
Hint: Use [parameters('name')] to reference parameters in resources [OK]
Common Mistakes:
  • Using parameter name as plain string
  • Thinking location must be variable
  • Assuming resource type is wrong
5. You want to output the public IP address of a VM created in your ARM template. Which section should you add this output to, and what is the correct syntax to reference the IP address property named "ipAddress" from a resource named "myPublicIP"?
hard
A. Add to outputs section with "ip": { "value": "[reference('myPublicIP').ipAddress]" }
B. Add to variables section with "ip": "myPublicIP.ipAddress"
C. Add to parameters section with "ipAddress": { "type": "string" }
D. Add to resources section with "outputs": { "ip": "myPublicIP.ipAddress" }

Solution

  1. Step 1: Identify output section usage

    Outputs section is used to return values after deployment, like IP addresses.
  2. Step 2: Use correct syntax to reference resource property

    Use the reference() function with resource name and property: "[reference('myPublicIP').ipAddress]".
  3. Final Answer:

    Add to outputs section with "ip": { "value": "[reference('myPublicIP').ipAddress]" } -> Option A
  4. Quick Check:

    Outputs use reference() to get resource properties [OK]
Hint: Use outputs section and reference() function for resource properties [OK]
Common Mistakes:
  • Putting outputs in variables or parameters
  • Using dot notation without reference()
  • Misplacing outputs inside resources