Learn how to deploy an Azure Resource Manager template (ARM template) from your local machine. It takes about 8 minutes to complete.
This tutorial is the first of a series. As you progress through the series, you modularize the template by creating a linked template, store the linked template in a storage account, secure the linked template by using SAS token, and learn how to create a DevOps pipeline to deploy templates. This series focuses on template deployment. If you want to learn template development, see the beginner tutorials.
Get tools
Make sure you have the tools you need to deploy templates.
Command-line deployment
To deploy the template, you need either Azure PowerShell or Azure CLI. For the installation instructions, see:
Templates are JSON files. To review or edit templates, you need a good JSON editor. We recommend using Visual Studio Code with the Resource Manager Tools extension. If you need to install these tools, see Quickstart: Create ARM templates with Visual Studio Code.
Review template
The template deploys a storage account, app service plan, and web app. If you're interested in creating the template, see Quickstart templates tutorial. However, you don't need to create the template to complete this tutorial.
Storage account names must be unique, between 3 and 24 characters in length, and use numbers and lowercase letters only. The sample template's storageAccountName variable combines the projectName parameter's maximum of 11 characters with a uniqueString value of 13 characters.
Save a copy of the template to your local computer with the .json extension, for example, azuredeploy.json. You deploy this template later in the tutorial.
Sign in to Azure
To start working with Azure PowerShell/Azure CLI to deploy a template, sign in with your Azure credentials.
If you have multiple Azure subscriptions, select the subscription you want to use. Replace [SubscriptionID/SubscriptionName] and the square brackets [] with your subscription information:
az account set --subscription[SubscriptionID/SubscriptionName]
Create resource group
When you deploy a template, you specify a resource group for the resources. Before running the deployment command, create the resource group with either Azure CLI or Azure PowerShell. To choose between Azure PowerShell and Azure CLI, select the tabs in the following code section. The CLI examples in this article are written for the Bash shell.
$projectName = Read-Host -Prompt"Enter a project name that is used to generate resource and resource group names"$resourceGroupName = "${projectName}rg"New-AzResourceGroup `
-Name$resourceGroupName `
-Location"Central US"
Azure CLI
echo "Enter a project name that is used to generate resource and resource group names:"
read projectName
resourceGroupName="${projectName}rg"az group create \
--name$resourceGroupName \
--location"Central US"
Deploy template
Use one or both deployment options to deploy the template.
To clean up the resources you deployed, delete 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.
Select Delete resource group from the top menu.
Next steps
You learned how to deploy a local template. In the next tutorial, you separate the template into a main template and a linked template. You also learn how to store and secure the linked template.
Build end-to-end solutions in Microsoft Azure to create Azure Functions, implement and manage web apps, develop solutions utilizing Azure storage, and more.
Create your first Azure Resource Manager template (ARM template). In the tutorial, you learn about the template file syntax and how to deploy a storage account.
Describes recommended approaches for authoring Azure Resource Manager templates (ARM templates). Offers suggestions to avoid common problems when using templates.