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 or Bicep 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 free account 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 searching for custom template in Azure portal.

  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 selecting a Quickstart Template in Azure portal.

  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 of input fields for custom template in Azure portal.

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

    Screenshot of template validation and create button in Azure portal.

  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 of deployment succeeded notification in Azure portal.

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

    Screenshot of view deployment page with storage account in Azure portal.

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 without 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 of build your own template option in Azure portal.

  3. You see a blank template.

    Screenshot of blank ARM template in Azure portal.

  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 of view second deployment page in Azure portal.

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

    Screenshot of resource group with storage account and virtual network in Azure portal.

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 of export template option in Azure portal.

  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 of download button for exported ARM template in Azure portal.

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: