az stack-whatif group

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

Commands

Name Description Type Status
az stack-whatif group create

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

Core GA
az stack-whatif group delete

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

Core GA
az stack-whatif group list

List all deployment stack what-if results in a resource group.

Core GA
az stack-whatif group show

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

Core GA

az stack-whatif group create

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

az stack-whatif group create --action-on-unmanage --aou {deleteAll, deleteResources, detachAll}
                             --deny-settings-mode --dm {denyDelete, denyWriteAndDelete, none}
                             --name
                             --resource-group
                             --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]
                             [--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 delete resources on unmanage.

az stack-whatif group create --name ResultName --resource-group ResourceGroup --action-on-unmanage deleteResources --template-file simpleTemplate.json --description description --deny-settings-mode None --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/providers/Microsoft.Resources/deploymentStacks/mySubStack

Perform a what-if on a deployment stack with parameter file, detach all resources on unmanage, and remove color from the output.

az stack-whatif group create --name ResultName --resource-group ResourceGroup --no-color --action-on-unmanage detachAll --template-file simpleTemplate.json --parameters simpleTemplateParams.json --description description --deny-settings-mode None --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/providers/Microsoft.Resources/deploymentStacks/mySubStack

Perform a what-if on a deployment stack with template spec and delete all resources on unmanage.

az stack-whatif group create --name ResultName --resource-group ResourceGroup --action-on-unmanage deleteAll --template-spec TemplateSpecResourceIDWithVersion --description description --deny-settings-mode None --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/providers/Microsoft.Resources/deploymentStacks/mySubStack

Perform a what-if on a deployment stack using bicep file.

az stack-whatif group create --name ResultName --resource-group ResourceGroup --template-file simple.bicep --description description --deny-settings-mode None --action-on-unmanage deleteResources --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/providers/Microsoft.Resources/deploymentStacks/mySubStack

Perform a what-if on a deployment stack at a different subscription.

az stack-whatif group create --name ResultName --resource-group ResourceGroup --template-file simpleTemplate.json --description description --subscription subscriptionId --deny-settings-mode None --action-on-unmanage deleteResources --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/providers/Microsoft.Resources/deploymentStacks/mySubStack

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

az stack-whatif group create --name ResultName --template-file simpleTemplate.json --resource-group ResourceGroup --description description --parameters simpleTemplateParams.json value1=foo value2=bar --deny-settings-mode None --action-on-unmanage deleteResources --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/providers/Microsoft.Resources/deploymentStacks/mySubStack

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 group create --name ResultName --template-file azuredeploy.json --parameters @params.json --parameters https://mysite/params.json --parameters MyValue=This MyArray=@array.json --resource-group ResourceGroup --deny-settings-mode None --action-on-unmanage deleteResources --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/providers/Microsoft.Resources/deploymentStacks/mySubStack

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

az stack-whatif group create --name ResultName --resource-group ResourceGroup --template-file azuredeploy.json --deny-settings-mode denyDelete --deny-settings-excluded-actions Microsoft.Compute/virtualMachines/write --deny-settings-excluded-principals "test1 test2" --action-on-unmanage deleteResources --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/providers/Microsoft.Resources/deploymentStacks/mySubStack

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

az stack-whatif group create --name ResultName --resource-group ResourceGroup --template-file azuredeploy.json --deny-settings-mode denyDelete --deny-settings-excluded-actions Microsoft.Compute/virtualMachines/write --deny-settings-apply-to-child-scopes --action-on-unmanage deleteResources --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/providers/Microsoft.Resources/deploymentStacks/mySubStack

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
--name -n

The name of the deployment stack what-if result.

--resource-group -g

The resource group where the deployment stack what-if result will be created.

--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.

--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 group delete

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

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

Examples

Delete stack what-if result by name.

az stack-whatif group delete --name ResultName --resource-group ResourceGroup

Delete stack what-if result by resource id.

az stack-whatif group delete --id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/providers/Microsoft.Resources/deploymentStacksWhatIfResults/ResultName

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.

--resource-group -g

The resource group where the deployment stack what-if result exists.

--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 group list

List all deployment stack what-if results in a resource group.

az stack-whatif group list --resource-group

Examples

List all stack what-if results in a resource group.

az stack-whatif group list --resource-group ResourceGroup

Required Parameters

--resource-group -g

The resource group where the deployment stack what-if result exists.

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 group show

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

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

Examples

Get a stack what-if result by name.

az stack-whatif group show --name ResultName --resource-group ResourceGroup

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

az stack-whatif group show --name ResultName --resource-group ResourceGroup --no-color

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

az stack-whatif group show --name ResultName --resource-group ResourceGroup --no-pretty-print

Get a stack what-if result by resource id.

az stack-whatif group show --id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup/providers/Microsoft.Resources/deploymentStacksWhatIfResults/ResultName

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.

--resource-group -g

The resource group where the deployment stack what-if result exists.

--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