az deployment mg

Manage Azure Resource Manager template deployment at management group.

Commands

az deployment mg cancel

Cancel a deployment at management group.

az deployment mg create

Start a deployment at management group.

az deployment mg delete

Delete a deployment at management group.

az deployment mg export

Export the template used for a deployment.

az deployment mg list

List deployments at management group.

az deployment mg show

Show a deployment at management group.

az deployment mg validate

Validate whether a template is valid at management group.

az deployment mg wait

Place the CLI in a waiting state until a deployment condition is met.

az deployment mg what-if

Execute a deployment What-If operation at management group scope.

az deployment mg cancel

Cancel a deployment at management group.

az deployment mg cancel --management-group-id
                        --name

Examples

Cancel a deployment at management group.

az deployment mg cancel -m testmg -n deployment01

Required Parameters

--management-group-id -m

The management group id.

--name -n

The deployment name.

az deployment mg create

Start a deployment at management group.

Please specify only one of --template-file FILE | --template-uri URI | --template-spec to input the ARM template.

az deployment mg create --location
                        --management-group-id
                        [--confirm-with-what-if]
                        [--handle-extended-json-format]
                        [--mode {Complete, Incremental}]
                        [--name]
                        [--no-prompt {false, true}]
                        [--no-wait]
                        [--parameters]
                        [--proceed-if-no-change]
                        [--query-string]
                        [--template-file]
                        [--template-spec]
                        [--template-uri]
                        [--what-if]
                        [--what-if-exclude-change-types {Create, Delete, Deploy, Ignore, Modify, NoChange, Unsupported}]
                        [--what-if-result-format {FullResourcePayloads, ResourceIdOnly}]

Examples

Create a deployment at management group from a remote template file, using parameters from a local JSON file.

az deployment mg create --management-group-id testrg --name rollout01 --location WestUS \
    --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json

Create a deployment at management group from a local template file, using parameters from a JSON string.

az deployment mg create --management-group-id testmg --name rollout01 --location WestUS \
    --template-file azuredeploy.json \
    --parameters '{ \"policyName\": { \"value\": \"policy2\" } }'

Create a deployment at management group from a local template, using a parameter file, a remote parameter file, and selectively overriding key/value pairs.

az deployment mg create --management-group-id testmg --name rollout01 --location WestUS \
    --template-file azuredeploy.json --parameters @params.json \
    --parameters https://mysite/params.json --parameters MyValue=This MyArray=@array.json

Required Parameters

--location -l

The location to store the deployment metadata.

--management-group-id -m

The management group id to create deployment at.

Optional Parameters

--confirm-with-what-if -c

Instruct the command to run deployment What-If before executing the deployment. It then prompts you to acknowledge resource changes before it continues.

--handle-extended-json-format -j

Support to handle extended template content including multiline and comments in deployment.

--mode

The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources.

accepted values: Complete, Incremental
default value: Incremental
--name -n

The deployment name.

--no-prompt

The option to disable the prompt of missing parameters for ARM template. When the value is true, the prompt requiring users to provide missing parameter will be ignored. The default value is false.

accepted values: false, true
default value: False
--no-wait

Do not wait for the long-running operation to finish.

default value: False
--parameters -p

Supply deployment parameter values.

--proceed-if-no-change

Instruct the command to execute the deployment if the What-If result contains no resource changes. Applicable when --confirm-with-what-if is set.

--query-string -q

The query string (a SAS token) to be used with the template-uri in the case of linked templates.

--template-file -f

The path to the template file or Bicep file.

--template-spec -s

The template spec resource id.

--template-uri -u

The URI to the template file.

--what-if -w

Instruct the command to run deployment What-If.

--what-if-exclude-change-types -x

Space-separated list of resource change types to be excluded from What-If results. Applicable when --confirm-with-what-if is set.

accepted values: Create, Delete, Deploy, Ignore, Modify, NoChange, Unsupported
--what-if-result-format -r

The format of What-If results. Applicable when --confirm-with-what-if is set.

accepted values: FullResourcePayloads, ResourceIdOnly
default value: FullResourcePayloads

az deployment mg delete

Delete a deployment at management group.

az deployment mg delete --management-group-id
                        --name
                        [--no-wait]

Examples

Delete a deployment at management group.

az deployment mg delete -m testmg -n deployment01

Required Parameters

--management-group-id -m

The management group id.

--name -n

The deployment name.

Optional Parameters

--no-wait

Do not wait for the long-running operation to finish.

default value: False

az deployment mg export

Export the template used for a deployment.

az deployment mg export --management-group-id
                        --name

Examples

Export the template used for a deployment at management group.

az deployment mg export --management-group-id testmg --name MyDeployment

Required Parameters

--management-group-id -m

The management group id.

--name -n

The deployment name.

az deployment mg list

List deployments at management group.

az deployment mg list --management-group-id
                      [--filter]

Examples

List deployments at management group.

az deployment mg list -m testmg

Required Parameters

--management-group-id -m

The management group id.

Optional Parameters

--filter

Filter expression using OData notation. You can use --filter "provisioningState eq '{state}'" to filter provisioningState. To get more information, please visit https://docs.microsoft.com/rest/api/resources/deployments/listatsubscriptionscope#uri-parameters.

az deployment mg show

Show a deployment at management group.

az deployment mg show --management-group-id
                      --name

Examples

Show a deployment at management group.

az deployment mg show -m testmg -n deployment01

Required Parameters

--management-group-id -m

The management group id.

--name -n

The deployment name.

az deployment mg validate

Validate whether a template is valid at management group.

Please specify only one of --template-file FILE | --template-uri URI | --template-spec to input the ARM template.

az deployment mg validate --location
                          --management-group-id
                          [--handle-extended-json-format]
                          [--name]
                          [--no-prompt {false, true}]
                          [--parameters]
                          [--query-string]
                          [--template-file]
                          [--template-spec]
                          [--template-uri]

Examples

Validate whether a template is valid at management group.

az deployment mg validate --management-group-id testmg --location WestUS --template-file {template-file}

Validate whether a template is valid at management group. (autogenerated)

az deployment mg validate --location WestUS --management-group-id testmg --name mydeployment --parameters @myparameters.json --template-file azuredeploy.json

Required Parameters

--location -l

The location to store the deployment metadata.

--management-group-id -m

The management group id to create deployment at.

Optional Parameters

--handle-extended-json-format -j

Support to handle extended template content including multiline and comments in deployment.

--name -n

The deployment name.

--no-prompt

The option to disable the prompt of missing parameters for ARM template. When the value is true, the prompt requiring users to provide missing parameter will be ignored. The default value is false.

accepted values: false, true
default value: False
--parameters -p

Supply deployment parameter values.

--query-string -q

The query string (a SAS token) to be used with the template-uri in the case of linked templates.

--template-file -f

The path to the template file or Bicep file.

--template-spec -s

The template spec resource id.

--template-uri -u

The URI to the template file.

az deployment mg wait

Place the CLI in a waiting state until a deployment condition is met.

az deployment mg wait --management-group-id
                      --name
                      [--created]
                      [--custom]
                      [--deleted]
                      [--exists]
                      [--interval]
                      [--timeout]
                      [--updated]

Required Parameters

--management-group-id -m

The management group id.

--name -n

The deployment name.

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

default value: False
--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--deleted

Wait until deleted.

default value: False
--exists

Wait until the resource exists.

default value: False
--interval

Polling interval in seconds.

default value: 30
--timeout

Maximum wait in seconds.

default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.

default value: False

az deployment mg what-if

Execute a deployment What-If operation at management group scope.

Please specify only one of --template-file FILE | --template-uri URI | --template-spec to input the ARM template.

az deployment mg what-if --location
                         --management-group-id
                         [--exclude-change-types {Create, Delete, Deploy, Ignore, Modify, NoChange, Unsupported}]
                         [--name]
                         [--no-pretty-print]
                         [--no-prompt {false, true}]
                         [--parameters]
                         [--query-string]
                         [--result-format {FullResourcePayloads, ResourceIdOnly}]
                         [--template-file]
                         [--template-spec]
                         [--template-uri]

Examples

Execute a deployment What-If operation at a management group.

az deployment mg what-if --management-group-id testmg --location westus --name rollout01 --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json

Execute a deployment What-If operation at a management group with ResourceIdOnly format.

az deployment mg what-if --management-group-id testmg --location westus --name rollout01 --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json --result-format ResourceIdOnly

Execute a deployment What-If operation at a management group without pretty-printing the result.

az deployment mg what-if --management-group-id testmg --location westus --name rollout01 --template-uri https://myresource/azuredeploy.json --parameters @myparameters.json --no-pretty-print

Required Parameters

--location -l

The location to store the deployment metadata.

--management-group-id -m

The management group id to create deployment at.

Optional Parameters

--exclude-change-types -x

Space-separated list of resource change types to be excluded from What-If results.

accepted values: Create, Delete, Deploy, Ignore, Modify, NoChange, Unsupported
--name -n

The deployment name.

--no-pretty-print

Disable pretty-print for What-If results. When set, the output format type will be used.

--no-prompt

The option to disable the prompt of missing parameters for ARM template. When the value is true, the prompt requiring users to provide missing parameter will be ignored. The default value is false.

accepted values: false, true
default value: False
--parameters -p

Supply deployment parameter values.

--query-string -q

The query string (a SAS token) to be used with the template-uri in the case of linked templates.

--result-format -r

The format of What-If results.

accepted values: FullResourcePayloads, ResourceIdOnly
default value: FullResourcePayloads
--template-file -f

The path to the template file or Bicep file.

--template-spec -s

The template spec resource id.

--template-uri -u

The URI to the template file.