This article answers frequently asked questions about Azure Resource Manager templates (ARM templates).
Getting started
What are ARM templates, and why should I use them?
ARM templates are JSON files where you define what you want to deploy to Azure. Templates help you implement an infrastructure-as-code solution for Azure. Your organization can repeatedly and reliably deploy the required infrastructure to different environments.
To learn more about how ARM templates help you manage your Azure infrastructure, see What are ARM templates?
How do I get started with templates?
To simplify authoring ARM templates, you need the right tools. We recommend installing Visual Studio Code and the Azure Resource Manager tools extension. For a quick introduction to these tools, see Quickstart: Create ARM templates with Visual Studio Code.
When you're ready to learn about creating ARM templates, start the beginner tutorial series on ARM templates. These tutorials take you step by step through the process of constructing an ARM template. You learn about the different sections of the template and how to they work together.
Should I use ARM templates or Terraform to deploy to Azure?
Use the option that you like the best. Both services assist you with automating deployments to Azure.
We believe there are benefits to using ARM templates over other infrastructure-as-code services. To learn about those benefits, see Why choose ARM templates?
Build 2020
I missed your presentation at Microsoft Build 2020. Is the presentation available for viewing?
Yes, watch it anytime.
Where can I get more information about the new features you announced at Build?
For general information about features we're working, join our Azure Advisors Deployments Yammer group.
To learn about the new template language, sign up for notifications.
To learn about template specs, see Azure Resource Manager template specs.
Creating and testing templates
Where can I learn about best practices for ARM templates?
For recommendations about how you implement your templates, see ARM template best practices. After creating a template, run the ARM test toolkit. It checks whether your template matches recommended practices.
I have set up my environment through the portal. Is there some way to get the template from an existing resource group?
Yes, you can export the template from a resource group. The exported template is a good starting point for learning about templates, but you'll probably want to revise it before using it in a production environment.
When exporting the template, you can select which resources you want to include in the template.
Can I create a resource group in an ARM template and deploy resources to it?
Yes, you can create a resource group in a template when you deploy the template at the level of your Azure subscription. For an example of creating a resource group and deploying resources, see Resource group and resources.
How can I test my template before deploying it?
We recommend running the ARM test toolkit and the what-if operation on your templates before deploying them. The test toolkit checks whether your template uses best practices. It provides warnings when it identifies changes that could improve how you've implemented your template.
The what-if operation shows the changes your template makes to your environment. You can see unintended changes before they're deployed. What-if also returns any errors it can detect during preflight validation. For example, if your template contains a syntactical error, it returns that error. It also returns any errors it can determine about the final state of the deployed resources. For example, if your template deploys a storage account with a name that is already in use, what-if returns that error.
Where can I find information about the properties that are available for each resource type?
VS Code provides intellisense for working with the resource properties.
I need to create multiple instances of a resource type. How do I create an iterator in my template?
Use the copy element to specify more than one instance. You can use copy on resources, properties, variables, and outputs.
Template language
I've heard you're working on a new template language. Where can I find out more about it?
To learn about the new language, see What is Bicep (Preview)?.
Is there a plan to support creating templates in YAML?
Currently, there's no plan to support YAML. We believe the new template language offers a solution that is easier to use than YAML or JSON.
Can I still write templates in JSON after the new template language has been released?
Yes, you can continue using JSON templates.
Will you offer a tool to convert my JSON templates to the new template language?
Template Specs
How are template specs and Azure Blueprints related?
Azure Blueprints will use template specs in its implementation by replacing the blueprint definition
resource with a template spec
resource. We provide a migration path to convert the blueprint definition into a template spec, but the blueprint definition APIs will still be supported. There are no changes to the blueprint assignment
resource. Blueprints remain a user-experience to compose a governed environment in Azure.
Do template specs replace linked templates?
No, but template specs are designed to work well with linked templates. You don't have to move the linked template to a publicly accessible endpoint before deploying the parent template. Instead, you package the parent template and its artifacts together when creating the template spec.
Can template specs be shared across subscriptions?
Yes, they can be used across subscriptions as long as the user has read access to the template spec. Template specs can't be used across tenants.
Scripts in templates
Can I include a script in my template to do tasks that aren't possible in a template?
Yes, use deployment scripts. You can include Azure PowerShell or Azure CLI scripts in your templates.
Can I still use custom script extensions and desired state configuration (DSC)?
Those options are still available and haven't changed. Deployment scripts are designed to perform actions that aren't related to the VM guest. If you need to run a script on a host operating system in a VM, then the custom script extension and/or DSC would be a better choice. However, deployment scripts have advantages, such as setting the timeout duration.
Are deployment scripts supported in Azure China 21vianet?
Yes, you can use deployment scripts in China East 2
region on Azure China 21vianet currently.
Preview changes before deployment
Can I preview the changes that happen before deploying a template?
Yes, use the what-if feature. It evaluates the current state of your environment and compares it to the state that will exist after deployment. You can examine the summarized changes to make sure the template doesn't have any unexpected results.
Can I use what-if with both incremental and complete modes?
Yes, both deployment modes are supported. For an example of using incremental mode, see Run what-if operation. For an example of using complete mode, see Confirm deletion.
Does what-if work with linked templates?
Yes, what-if evaluates the state of the parent template and its linked templates.
Can I use what-if in an Azure Pipeline?
Yes, you can use what-if to verify that the Pipeline should continue.
When I use what-if, I see changes in properties that aren't in my template. Is this "noise" expected?
We're working on reducing the noise. You help us improve by submitting issues in our GitHub repo here: https://aka.ms/WhatIfIssues
Template visualizer
Is there a way for me to visualize my ARM template and its resources?
We have a community-contributed VS Code extension that does a great job of visualizing your ARM template. It shows the resources you're deploying and the relationships between them.
Can I use the template visualizer outside of VS Code?
The template visualizer is being previewed in the portal. For more information, watch this short session from Build.
Deployment limits
How many resource groups can I deploy to in a single deployment operation?
In the past, this limit was five resource groups. It has recently been increased to 800 resource groups. For more information, see Create resource groups and resources at the subscription level.
I got an error about being limited to 800 deployments in the deployment history. What should I do?
We're changing how the deployment history for a resource group is maintained. In the past, you had to manually delete deployments from this history to avoid this error. Starting in June 2020, we'll automatically delete deployments from the history as you get near the limit. For more information, see Automatic deletions from deployment history.
Deleting a deployment from the history doesn't affect the deployed resources.
Templates and DevOps
Can I integrate ARM templates into Azure Pipelines?
Yes. For an explanation of how to use template and pipelines, see Tutorial: Continuous integration of ARM templates with Azure Pipelines and Integrate ARM templates with Azure Pipelines.
Can I use GitHub Actions to deploy a template?
Next steps
For an introduction to ARM templates, see What are ARM templates?.