az stack-whatif sub

Manage Deployment stacks what-if results at subscription scope.

Commands

Name Description Type Status
az stack-whatif sub create

Create a deployment stack what-if result at subscription scope.

Core GA
az stack-whatif sub delete

Delete a deployment stack what-if result from subscription scope.

Core GA
az stack-whatif sub list

List all deployment stack what-if results in a subscription.

Core GA
az stack-whatif sub show

Get a deployment stack what-if result from subscription scope.

Core GA

az stack-whatif sub create

Create a deployment stack what-if result at subscription scope.

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

az stack-whatif sub create --name StackName --template-file simpleTemplate.json --location westus2 --description description --deny-settings-mode None --action-on-unmanage detachAll --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/deploymentStacks/mySubStack

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

az stack-whatif sub create --name StackName --action-on-unmanage deleteResources --no-color --template-file simpleTemplate.json --parameters simpleTemplateParams.json --location westus2 --description description --deny-settings-mode None --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/deploymentStacks/mySubStack

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

az stack-whatif sub create --name StackName --template-spec TemplateSpecResourceIDWithVersion --location westus2 --description description --deny-settings-mode None --action-on-unmanage deleteResources --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/deploymentStacks/mySubStack

Perform a what-if on a deployment stack using bicep file and delete all resources on unmanage.

az stack-whatif sub create --name StackName --action-on-unmanage deleteAll --template-file simple.bicep --location westus2 --description description --deny-settings-mode None --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/deploymentStacks/mySubStack

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

az stack-whatif sub create --name StackName --template-file simpleTemplate.json --location westus2 --description description --subscription subscriptionId --deny-settings-mode None --action-on-unmanage deleteResources --ri P5D --stack-id /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/deploymentStacks/mySubStack

Perform a what-if on a deployment stack and deploy at the resource group scope.

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

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

az stack-whatif sub create --name StackName --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 /subscriptions/00000000-0000-0000-0000-000000000000/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 sub create --name StackName --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 /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/deploymentStacks/mySubStack

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

az stack-whatif sub create --name StackName --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 /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Resources/deploymentStacks/mySubStack

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

az stack-whatif sub create --name StackName --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 /subscriptions/00000000-0000-0000-0000-000000000000/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
--location -l

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

--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-resource-group --dr

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

Delete a deployment stack what-if result from subscription scope.

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

Examples

Delete a stack what-if result by name.

az stack-whatif sub delete --name StackName

Delete a stack what-if result by resource id.

az stack-whatif sub delete --id /subscriptions/00000000-0000-0000-0000-000000000000/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.

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

List all deployment stack what-if results in a subscription.

az stack-whatif sub list

Examples

List all stack what-if results the current subscription.

az stack-whatif sub list
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 sub show

Get a deployment stack what-if result from subscription scope.

az stack-whatif sub show [--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 sub show --name ResultName

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

az stack-whatif sub show --name ResultName --no-color

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

az stack-whatif sub show --name ResultName --no-pretty-print

Get a stack what-if result by resource id.

az stack-whatif sub show --id /subscriptions/00000000-0000-0000-0000-000000000000/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.

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