Tutorial: Utilize the ARM template reference
Learn how to find the template schema information, and use the information to create Azure Resource Manager templates (ARM templates).
In this tutorial, you use a base template from Azure Quickstart Templates. Using template reference documentation, you validate the template.
This tutorial covers the following tasks:
- Open a Quickstart template
- Understand the template
- Find the template reference
- Edit the template
- Deploy the template
If you don't have an Azure subscription, create a trial subscription before you begin.
Prerequisites
To complete this article, you need:
- Visual Studio Code with Resource Manager Tools extension. See Quickstart: Create ARM templates with Visual Studio Code.
Open a Quickstart template
Azure Quickstart Templates is a repository for ARM templates. Instead of creating a template from scratch, you can find a sample template and customize it. The template used in this quickstart is called Create a standard storage account. The template defines an Azure Storage account resource.
From Visual Studio Code, select File > Open File.
In File name, paste the following URL:
https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.storage/storage-account-create/azuredeploy.json
Select Open to open the file.
Select File > Save As to save the file as azuredeploy.json to your local computer.
Understand the schema
From Visual Studio Code, collapse the template to the root level. You have the simplest structure with the following elements:
$schema
: specify the location of the JSON schema file that describes the version of the template language.contentVersion
: specify any value for this element to document significant changes in your template.metadata
: specify the metadata of the template.parameters
: specify the values that are provided when deployment is executed to customize resource deployment.variables
: specify the values that are used as JSON fragments in the template to simplify template language expressions. This template doesn't contain this element.resources
: specify the resource types that are deployed or updated in a resource group.outputs
: specify the values that are returned after deployment.
Expand
resources
. There's aMicrosoft.Storage/storageAccounts
resource defined. The API version shown on the screenshot is 2022-09-01. The SKU name uses a parameter value. The parameter is calledstorageAccountType
.Expand
parameters
to see howstorageAccountType
is defined. The parameter has eight allowed values.
Deploy the template
From the local Shell, run the following commands with administrator priviledge. Select the tab to show the PowerShell code or the CLI code.
When you deploy the template, specify the
storageAccountType
parameter with a newly added value, for example, Standard_RAGRS. The deploy would fail if you used the original quickstart template because Standard_RAGRS wasn't an allowed value.echo "Enter a project name that is used to generate resource group name:" && read projectName && echo "Enter the location (i.e. chinaeast):" && read location && resourceGroupName="${projectName}rg" && az group create --name $resourceGroupName --location "$location" && az deployment group create --resource-group $resourceGroupName --template-file "$HOME/azuredeploy.json" --parameters storageAccountType='Standard_RAGRS'
Clean up resources
When the Azure resources are no longer needed, clean up the resources you deployed by deleting the resource group.
- From the Azure portal, select Resource group from the left menu.
- Enter the resource group name in the Filter by name field.
- Select the resource group name. You shall see a total of six resources in the resource group.
- Select Delete resource group from the top menu.
Next steps
In this tutorial, you learned how to use template reference to customize an existing template. To learn how to create multiple storage account instances, see: