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
ARM template structure
📖 Scenario: You are working as a cloud engineer for a small company. Your manager wants you to create a simple Azure Resource Manager (ARM) template to deploy a storage account. This template will help automate the deployment process and ensure consistency.
🎯 Goal: Create a basic ARM template with the correct structure to deploy an Azure Storage Account resource.
📋 What You'll Learn
Create the ARM template skeleton with schema, contentVersion, parameters, variables, resources, and outputs sections.
Add a parameter called storageAccountName of type string.
Add a resource of type Microsoft.Storage/storageAccounts with API version 2022-09-01.
Set the storage account name using the storageAccountName parameter.
Set the location to eastus.
Set the SKU name to Standard_LRS.
Set the kind to StorageV2.
Output the storage account resource ID.
💡 Why This Matters
🌍 Real World
ARM templates are used to automate and standardize Azure resource deployments in real companies, saving time and reducing errors.
💼 Career
Understanding ARM template structure is essential for cloud engineers and DevOps professionals working with Azure infrastructure automation.
Progress0 / 4 steps
1
Create the ARM template skeleton
Create an ARM template JSON with the top-level keys: $schema, contentVersion, parameters, variables, resources, and outputs. Set $schema to "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#" and contentVersion to "1.0.0.0". Leave parameters, variables, resources, and outputs as empty objects or arrays as appropriate.
Azure
Hint
Start by creating the main structure of an ARM template with the required top-level keys.
2
Add a parameter for storage account name
Inside the parameters section, add a parameter called storageAccountName of type string.
Azure
Hint
Parameters allow you to pass values when deploying the template. Add the storageAccountName parameter with type string.
3
Add the storage account resource
Inside the resources array, add a resource object with type set to Microsoft.Storage/storageAccounts, apiVersion set to 2022-09-01, name set to the parameter storageAccountName, location set to eastus, sku with name as Standard_LRS, and kind set to StorageV2. Leave properties as an empty object.
Azure
Hint
The resource section defines what Azure resources to create. Use the parameter for the storage account name and set the required properties.
4
Add output for the storage account resource ID
Inside the outputs section, add an output called storageAccountId of type string. Set its value to the resource ID of the storage account using the ARM function resourceId with the resource type Microsoft.Storage/storageAccounts and the storage account name parameter.
Azure
Hint
Outputs let you get information about deployed resources. Use the resourceId function to get the storage account's ID.
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
Step 1: Understand ARM template sections
An ARM template has sections like parameters, variables, resources, and outputs.
Step 2: Identify the section for Azure resources
The 'resources' section lists the Azure services and components to create.
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
Step 1: Check resource name usage
The resource name is set as "storageName" string, but it should reference the parameter.
Step 2: Correct parameter reference syntax
Parameters are referenced with "[parameters('storageName')]" to use the parameter value.
Final Answer:
The resource name should use parameter syntax with brackets -> Option B
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
Step 1: Identify output section usage
Outputs section is used to return values after deployment, like IP addresses.
Step 2: Use correct syntax to reference resource property
Use the reference() function with resource name and property: "[reference('myPublicIP').ipAddress]".
Final Answer:
Add to outputs section with "ip": { "value": "[reference('myPublicIP').ipAddress]" } -> Option A
Quick Check:
Outputs use reference() to get resource properties [OK]
Hint: Use outputs section and reference() function for resource properties [OK]