LinuxCommandLibrary

az-deployment

TLDR

Create a resource group deployment from a template

$ az deployment group create --resource-group [rg_name] --template-file [template.json]
copy
Deploy with parameters file
$ az deployment group create --resource-group [rg_name] --template-file [template.json] --parameters [parameters.json]
copy
Deploy a Bicep file
$ az deployment group create --resource-group [rg_name] --template-file [main.bicep]
copy
Validate a deployment without executing
$ az deployment group validate --resource-group [rg_name] --template-file [template.json]
copy
Show deployment details
$ az deployment group show --resource-group [rg_name] --name [deployment_name]
copy
List deployments in a resource group
$ az deployment group list --resource-group [rg_name]
copy
Delete a deployment
$ az deployment group delete --resource-group [rg_name] --name [deployment_name]
copy
Deploy at subscription scope
$ az deployment sub create --location [eastus] --template-file [template.json]
copy

SYNOPSIS

az deployment scope subcommand [options]

DESCRIPTION

az deployment is a subcommand of the Azure CLI that manages Azure Resource Manager (ARM) deployments. It deploys infrastructure as code using ARM templates (JSON) or Bicep files to create and update Azure resources.
Deployments can target different scopes: resource group, subscription, management group, or tenant. The template defines resources to create, their properties, and dependencies. Parameters allow customization without modifying templates.
Deployment modes include incremental (add/update resources) and complete (remove resources not in template). What-if operations preview changes before deployment.

PARAMETERS

group create

Deploy at resource group scope.
group validate
Validate template without deploying.
group show
Show deployment details.
group list
List deployments in a resource group.
group delete
Remove deployment history entry.
group what-if
Preview deployment changes.
sub create
Deploy at subscription scope.
mg create
Deploy at management group scope.
tenant create
Deploy at tenant scope.
--resource-group rg
Target resource group.
--template-file file
Path to ARM template or Bicep file.
--template-uri uri
URL to template file.
--parameters params
Parameter values (file path or inline).
--name name
Deployment name.
--mode mode
Incremental or Complete.
--location region
Required for subscription-scope deployments.
--confirm-with-what-if
Show what-if and prompt before deploying.

CAVEATS

Complete mode deletes resources not in the template; use with caution. Deployment history is limited to 800 entries per resource group (auto-deleted oldest). Template file size limit is 4 MB. Nested templates require linked deployments or template specs for larger infrastructures. Bicep files are compiled to ARM JSON before deployment.

HISTORY

Azure Resource Manager templates launched in 2014 as Azure's infrastructure as code solution. The deployment commands evolved through several CLI versions. What-if preview functionality was added in 2020. Bicep, a domain-specific language that compiles to ARM templates, reached version 1.0 in May 2021 and has become the recommended authoring experience. Template specs for versioned, shareable templates were introduced in 2020.

SEE ALSO

az(1), az-group(1), az-bicep(1), az-resource(1)

Copied to clipboard