Quickstart: Create and deploy ARM templates by using the Azure portal

In this quickstart, you learn how to create an Azure Resource Manager template (ARM template) in the Azure portal. You edit and deploy the template from the portal.

ARM templates are JSON files that define the resources you need to deploy for your solution. To understand the concepts associated with deploying and managing your Azure solutions, see template deployment overview.

After completing the tutorial, you deploy an Azure Storage account. The same process can be used to deploy other Azure resources.

If you don't have an Azure subscription, create a Trial before you begin.

Retrieve a custom template

Rather than manually building an entire ARM template, let's start by retrieving a pre-built template that accomplishes our goal. The Azure Quickstart Templates repo repo contains a large collection of templates that deploy common scenarios. The portal makes it easy for you find and use templates from this repo. You can save the template and reuse it later.

  1. In a web browser, go to the Azure portal and sign in.

  2. From the Azure portal search bar, search for deploy a custom template and then select it from the available options.

    Screenshot of Search for Custom Template.

  3. For Template source, notice that Quickstart template is selected by default. You can keep this selection. In the drop-down, search for quickstarts/microsoft.storage/storage-account-create and select it. After finding the quickstart template, select Select template.

    Screenshot of Select Quickstart Template.

  4. In the next blade, you provide custom values to use for the deployment.

    For Resource group, select Create new and provide myResourceGroup for the name. You can use the default values for the other fields. When you've finished providing values, select Review + create.

    Screenshot for Input Fields for Template.

  5. The portal validates your template and the values you provided. After validation succeeds, select Create to start the deployment.

    Screenshot for Validation and create.

  6. Once your validation has passed, you'll see the status of the deployment. When it completes successfully, select Go to resource to see the storage account.

    Screenshot for Deployment Succeeded Notification.

  7. From this screen, you can view the new storage account and its properties.

    Screenshot for View Deployment Page.

Edit and deploy the template

You can use the portal for quickly developing and deploying ARM templates. In general, we recommend using Visual Studio Code for developing your ARM templates, and Azure CLI or Azure PowerShell for deploying the template, but you can use the portal for quick deployments without installing those tools.

In this section, let's suppose you have an ARM template that you want to deploy one time with setting up the other tools.

  1. Again, select Deploy a custom template in the portal.

  2. This time, select Build your own template in the editor.

    Screenshot for Build your own template.

  3. You see a blank template.

    Screenshot for Blank Template.

  4. Replace the blank template with the following template. It deploys a virtual network with a subnet.

    {
      "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
      "contentVersion": "1.0.0.0",
      "parameters": {
        "vnetName": {
          "type": "string",
          "defaultValue": "VNet1",
          "metadata": {
            "description": "VNet name"
          }
        },
        "vnetAddressPrefix": {
          "type": "string",
          "defaultValue": "10.0.0.0/16",
          "metadata": {
            "description": "Address prefix"
          }
        },
        "subnetPrefix": {
          "type": "string",
          "defaultValue": "10.0.0.0/24",
          "metadata": {
            "description": "Subnet Prefix"
          }
        },
        "subnetName": {
          "type": "string",
          "defaultValue": "Subnet1",
          "metadata": {
            "description": "Subnet Name"
          }
        },
        "location": {
          "type": "string",
          "defaultValue": "[resourceGroup().location]",
          "metadata": {
            "description": "Location for all resources."
          }
        }
      },
      "resources": [
        {
          "type": "Microsoft.Network/virtualNetworks",
          "apiVersion": "2021-08-01",
          "name": "[parameters('vnetName')]",
          "location": "[parameters('location')]",
          "properties": {
            "addressSpace": {
              "addressPrefixes": [
                "[parameters('vnetAddressPrefix')]"
              ]
            },
            "subnets": [
              {
                "name": "[parameters('subnetName')]",
                "properties": {
                  "addressPrefix": "[parameters('subnetPrefix')]"
                }
              }
            ]
          }
        }
      ]
    }
    
  5. Select Save.

  6. You see the blade for providing deployment values. Again, select myResourceGroup for the resource group. You can use the other default values. When you're done providing values, select Review + create

  7. After the portal validates the template, select Create.

  8. When the deployment completes, you see the status of the deployment. This time select the name of the resource group.

    Screenshot for View second deployment.

  9. Notice that your resource group now contains a storage account and a virtual network.

    Screenshot for View Storage Account and Virtual Network.

Export a custom template

Sometimes the easiest way to work with an ARM template is to have the portal generate it for you. The portal can create an ARM template based on the current state of your resource group.

  1. In your resource group, select Export template.

    Screenshot for Export Template.

  2. The portal generates a template for you based on the current state of the resource group. Notice that this template isn't the same as either template you deployed earlier. It contains definitions for both the storage account and virtual network, along with other resources like a blob service that was automatically created for your storage account.

  3. To save this template for later use, select Download.

    Screenshot for Download exported template.

You now have an ARM template that represents the current state of the resource group. This template is auto-generated. Before using the template for production deployments, you may want to revise it, such as adding parameters for template reuse.

Clean up resources

When the Azure resources are no longer needed, clean up the resources you deployed by deleting the resource group.

  1. In the Azure portal, select Resource groups on the left menu.
  2. Enter the resource group name in the Filter for any field search box.
  3. Select the resource group name. You shall see the storage account in the resource group.
  4. Select Delete resource group in the top menu.

Next steps

In this tutorial, you learned how to generate a template from the Azure portal, and how to deploy the template using the portal. The template used in this Quickstart is a simple template with one Azure resource. When the template is complex, it's easier to use Visual Studio Code, or Visual Studio to develop the template. To learn more about template development, see our new beginner tutorial series: