0
0
Azurecloud~30 mins

ARM template parameters and variables in Azure - Mini Project: Build & Apply

Choose your learning style9 modes available
ARM template parameters and variables
📖 Scenario: You are setting up an Azure Resource Manager (ARM) template to deploy a simple storage account. You want to make the template flexible by using parameters and variables.
🎯 Goal: Create an ARM template that uses parameters to accept the storage account name and location, and variables to define the storage account kind and SKU. This template will help you deploy storage accounts with different names and locations easily.
📋 What You'll Learn
Use a parameter called storageAccountName with type string.
Use a parameter called location with type string.
Create a variable called storageAccountKind with value StorageV2.
Create a variable called storageAccountSku with value Standard_LRS.
Use the parameters and variables in the storage account resource definition.
💡 Why This Matters
🌍 Real World
ARM templates are used to automate Azure resource deployment with reusable and configurable templates.
💼 Career
Understanding parameters and variables in ARM templates is essential for cloud engineers and DevOps professionals managing Azure infrastructure.
Progress0 / 4 steps
1
Create ARM template parameters
Create the parameters section in the ARM template JSON with two parameters: storageAccountName of type string and location of type string.
Azure
Need a hint?

Parameters let you pass values when deploying the template. Use the exact names storageAccountName and location with type string.

2
Add variables for storage account kind and SKU
Add a variables section with two variables: storageAccountKind set to StorageV2 and storageAccountSku set to Standard_LRS.
Azure
Need a hint?

Variables hold values you want to reuse inside the template. Use the exact variable names and values.

3
Add storage account resource using parameters and variables
Add a resource of type Microsoft.Storage/storageAccounts with name from parameters('storageAccountName'), location from parameters('location'), kind from variables('storageAccountKind'), and sku name from variables('storageAccountSku'). Use API version 2021-04-01.
Azure
Need a hint?

Use the parameters() and variables() functions to reference values inside the resource definition.

4
Add output for storage account resource ID
Add an outputs section with an output named storageAccountId that returns the resource ID of the storage account using resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')).
Azure
Need a hint?

Outputs let you get information from the deployed resources. Use the resourceId function with the exact syntax shown.