Key benefits
- Consistent and reusable: Templates produce predictable environments. Using
parametersavoids hard-coded values and makes templates reusable across environments. - Single-operation deployment: Deploy a complete set of resources in one action, reducing human error versus manual creation.
- Modular and scalable: Break complex deployments into smaller templates that are linked or nested so dependencies and deployment order are managed automatically.
Template design approaches
Choose an approach based on the size and lifecycle of your deployment:- Single template: All resources in one ARM template — simple for small deployments (one or two resources).
- Nested/linked templates: A main template references smaller templates (for VMs, App Services, SQL, etc.). Use this for complex environments to separate concerns and enable reuse.
- Separate templates per resource group: Maintain independent templates for resources grouped into different resource groups and deploy them separately.
Consider a three-tier application: front-end App Service (or VM), middle-tier App Service, and back-end SQL Database. Options include:
- Deploy all three tiers from a single template and reference the SQL Database from the App Service configuration.
- Use a main template to create the resource group and kick off nested templates for each tier.
- Deploy each tier with separate templates to different resource groups for isolation.

ARM template structure — field explanations
Below is the same skeleton followed by concise descriptions of the top-level elements you will use most often:$schema: Location of the JSON schema that validates the template structure. Enables tooling, schema validation, and IntelliSense.contentVersion: A version string for your template for tracking changes (not interpreted by Azure).parameters: Values supplied at deployment time to customize behavior (for example, VM size, admin username, orlocation). Use parameters to make templates flexible and reusable.functions: Optional user-defined functions to reuse expressions across the template.variables: Computed values or aliases derived from parameters/constants to simplify resource definitions.resources: An array of resource objects that the template will deploy. Each resource typically includestype,apiVersion,name,properties, and optional dependencies (dependsOn).outputs: Values returned after deployment completes, such as connection strings, endpoints, or resource IDs.
Authoring tools
For authoring and validating ARM templates, the Azure Resource Manager (ARM) Tools extension for Visual Studio Code greatly improves developer productivity by offering snippets, schema validation, and IntelliSense.
This extension is optional and not required, but it helps with writing and validating ARM templates.
Links and references
- Official ARM templates documentation: https://learn.microsoft.com/azure/azure-resource-manager/templates/
- ARM Tools (VS Code) extension: https://marketplace.visualstudio.com/items?itemName=msazurermtools.azurerm-vscode-tools
When deploying templates, ensure the identity used for the deployment has the required RBAC permissions for the resources being created. Misconfigured permissions can cause deployments to fail or to be only partially applied.