az stack-whatif mg

Manage Deployment stacks what-if results at management group scope.

Commands

Name Description Type Status
az stack-whatif mg create

Create a deployment stack what-if result at management group scope.

Core GA
az stack-whatif mg delete

Delete a deployment stack what-if result from management group scope.

Core GA
az stack-whatif mg list

List all deployment stacks what-if results in a management group.

Core GA
az stack-whatif mg show

Get a deployment stack what-if result from management group scope.

Core GA

az stack-whatif mg create

Create a deployment stack what-if result at management group scope.

az stack-whatif mg create --action-on-unmanage --aou {deleteAll, deleteResources, detachAll}
                          --deny-settings-mode --dm {denyDelete, denyWriteAndDelete, none}
                          --location
                          --management-group-id
                          --name
                          --retention-interval --ri
                          --stack-id
                          [--acquire-policy-token]
                          [--change-reference]
                          [--cs --deny-settings-apply-to-child-scopes]
                          [--deny-settings-excluded-actions --ea]
                          [--deny-settings-excluded-principals --ep]
                          [--deployment-subscription --ds]
                          [--description]
                          [--no-color]
                          [--no-pretty-print]
                          [--no-wait]
                          [--parameters]
                          [--query-string]
                          [--resources-without-delete-support --rwd {detach, fail}]
                          [--tags]
                          [--template-file]
                          [--template-spec]
                          [--template-uri]
                          [--validation-level --vl {Provider, ProviderNoRbac, Template}]

Examples

Perform a what-if on a deployment stack using template file and detach all unmanaged resources.

az stack-whatif mg create --name StackName --management-group-id myMg --template-file simpleTemplate.json --parameters simpleTemplateParams.json --location westus2 --description description --deny-settings-mode None --action-on-unmanage detachAll --ri P5D --stack-id /providers/Microsoft.Management/myMg/providers/Microsoft.Resources/deploymentStacks/myMgStack

Perform a what-if on a deployment stack with template spec.

az stack-whatif mg create --name StackName --management-group-id myMg --template-spec TemplateSpecResourceIDWithVersion --location westus2 --description description --deny-settings-mode None --action-on-unmanage deleteResources --ri P5D --stack-id /providers/Microsoft.Management/myMg/providers/Microsoft.Resources/deploymentStacks/myMgStack

Perform a what-if on a deployment stack using bicep file, delete all resources on unmanage, and remove color from the output.

az stack-whatif mg create --name StackName --management-group-id myMg --no-color --action-on-unmanage deleteAll --template-file simple.bicep --location westus2 --description description --deny-settings-mode None --ri P5D --stack-id /providers/Microsoft.Management/myMg/providers/Microsoft.Resources/deploymentStacks/myMgStack

Perform a what-if on a deployment stack using parameters from key/value pairs.

az stack-whatif mg create --name StackName --management-group-id myMg --template-file simpleTemplate.json --location westus --description description --parameters simpleTemplateParams.json value1=foo value2=bar --deny-settings-mode None --action-on-unmanage deleteResources --ri P5D --stack-id /providers/Microsoft.Management/myMg/providers/Microsoft.Resources/deploymentStacks/myMgStack

Perform a what-if on a deployment stack from a local template, using a parameter file, a remote parameter file, and selectively overriding key/value pairs.

az stack-whatif mg create --name StackName --management-group-id myMg --template-file azuredeploy.json --parameters @params.json --parameters https://mysite/params.json --parameters MyValue=This MyArray=@array.json --location westus --deny-settings-mode None --action-on-unmanage deleteResources --ri P5D --stack-id /providers/Microsoft.Management/myMg/providers/Microsoft.Resources/deploymentStacks/myMgStack

Perform a what-if on a deployment stack from a local template, using deny settings.

az stack-whatif mg create --name StackName --management-group-id myMg --template-file azuredeploy.json --deny-settings-mode denyDelete --deny-settings-excluded-actions Microsoft.Compute/virtualMachines/write --deny-settings-excluded-principals "test1 test2" --location westus --action-on-unmanage deleteResources --ri P5D --stack-id /providers/Microsoft.Management/myMg/providers/Microsoft.Resources/deploymentStacks/myMgStack

Perform a what-if on a deployment stack from a local template, apply deny settings to child scope.

az stack-whatif mg create --name StackName --management-group-id myMg --template-file azuredeploy.json --deny-settings-mode denyDelete --deny-settings-excluded-actions Microsoft.Compute/virtualMachines/write --deny-settings-apply-to-child-scopes --location westus --action-on-unmanage deleteResources --ri P5D --stack-id /providers/Microsoft.Management/myMg/providers/Microsoft.Resources/deploymentStacks/myMgStack

Required Parameters

--action-on-unmanage --aou

Defines what happens to resources that are no longer managed after the stack is updated or deleted.

Property Value
Accepted values: deleteAll, deleteResources, detachAll
--deny-settings-mode --dm

Define which operations are denied on resources managed by the stack.

Property Value
Accepted values: denyDelete, denyWriteAndDelete, none
--location -l

The location to store the deployment stack what-if result.

--management-group-id -m

The management group ID to create a deployment stack what-if result in.

--name -n

The name of the deployment stack what-if result.

--retention-interval --ri

The retention interval for What-If results. The value must be in ISO 8601 format and between 1 day and 30 days.

--stack-id

The fully-qualified ID of the deployment stack to perform a what-if operation on.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--cs --deny-settings-apply-to-child-scopes

DenySettings will be applied to child scopes.

Property Value
Default value: False
--deny-settings-excluded-actions --ea

List of role-based management operations that are excluded from the denySettings. Up to 200 actions are permitted.

--deny-settings-excluded-principals --ep

List of AAD principal IDs excluded from the lock. Up to 5 principals are permitted.

--deployment-subscription --ds

The scope at which the initial deployment should be created. If a scope is not specified, it will default to the scope of the deployment stack.

--description

The description of deployment stack.

--no-color

Disable color in pretty-printed what-if results.

--no-pretty-print

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

--no-wait

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

Property Value
Default value: False
--parameters -p

Parameters may be supplied from a file using the @{path} syntax, a JSON string, or as <KEY=VALUE> pairs. Parameters are evaluated in order, so when a value is assigned twice, the latter value will be used. It is recommended that you supply your parameters file first, and then override selectively using KEY=VALUE syntax.

--query-string -q

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

--resources-without-delete-support --rwd

Defines what happens to resources that do not support deletion when they are no longer managed by the stack.

Property Value
Accepted values: detach, fail
--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--template-file -f

A path to a template file or Bicep file in the file system.

--template-spec -s

The template spec resource id.

--template-uri -u

A uri to a remote template file.

--validation-level --vl

Validation level for the deployment stack. The default is 'Provider'.

Property Value
Accepted values: Provider, ProviderNoRbac, Template
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az stack-whatif mg delete

Delete a deployment stack what-if result from management group scope.

az stack-whatif mg delete --management-group-id
                          [--acquire-policy-token]
                          [--change-reference]
                          [--id]
                          [--name]
                          [--yes]

Examples

Delete a stack what-if result by name.

az stack-whatif mg delete --name ResultName --management-group-id myMg

Delete a stack what-if result by resource id.

az stack-whatif mg delete --id /providers/Microsoft.Management/managementGroups/myMg/providers/Microsoft.Resources/deploymentStacksWhatIfResults/ResultName --management-group-id myMg

Required Parameters

--management-group-id -m

The management group ID to create a deployment stack what-if result in.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--id

The deployment stack what-if result resource ID.

--name -n

The name of the deployment stack what-if result.

--yes

Do not prompt for confirmation.

Property Value
Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az stack-whatif mg list

List all deployment stacks what-if results in a management group.

az stack-whatif mg list --management-group-id

Examples

List all stack what-if results in management group.

az stack-whatif mg list --management-group-id myMg

Required Parameters

--management-group-id -m

The management group ID to create a deployment stack what-if result in.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az stack-whatif mg show

Get a deployment stack what-if result from management group scope.

az stack-whatif mg show --management-group-id
                        [--id]
                        [--name]
                        [--no-color]
                        [--no-pretty-print]
                        [--with-property-changes --wpc {false, true}]

Examples

Get a stack what-if result by name.

az stack-whatif mg show --name ResultName --management-group-id myMg

Get a stack what-if result by name without color.

az stack-whatif mg show --name ResultName --management-group-id myMg --no-color

Get JSON for a stack what-if result by name.

az stack-whatif mg show --name ResultName --management-group-id myMg --no-pretty-print

Get a stack what-if result by resource id.

az stack-whatif mg show --id /providers/Microsoft.Management/managementGroups/myMg/providers/Microsoft.Resources/deploymentStacksWhatIfResults/ResultName --management-group-id myMg

Required Parameters

--management-group-id -m

The management group ID to create a deployment stack what-if result in.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--id

The deployment stack what-if result resource ID.

--name -n

The name of the deployment stack what-if result.

--no-color

Disable color in pretty-printed what-if results.

--no-pretty-print

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

--with-property-changes --wpc

Flag to return the What-If results with resource property changes included.

Property Value
Accepted values: false, true
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False