This cmdlet has the following aliases,
Get-AzSubscriptionDeploymentWhatIfResult
Description
Runs an ARM/Bicep what-if operation at the subscription scope and returns the set of resource changes the deployment would produce — additions, modifications, deletions, and no-ops — without creating or modifying any resources. The template is supplied as a local ARM JSON or Bicep file (-TemplateFile), a URL (-TemplateUri), a template spec (-TemplateSpecId), or an inline hashtable (-TemplateObject). Bicep files are compiled with the Bicep CLI, which must be installed. Template parameters can be supplied via file (-ParametersFile), URI (-ParametersUri), or as Name=Value pairs through -Parameter. -QueryString supplies a query string for the template URI, not template parameter values.
Use -ResultFormat ResourceIdOnly for a compact summary, or -ResultFormat FullResourcePayloads (default) to include the full predicted resource bodies.
Examples
Preview a Bicep file with inline parameters
Preview the changes main.bicep would make, and supply its parameters inline.
The Azure region that stores the what-if operation metadata, for example eastus. Subscription-scope deployments have no resource group to inherit a region from, so a location is required.
The deployment name to evaluate. When omitted, it defaults to the template file or URI name, or to a new GUID when that name is not a valid deployment name.
Template parameters supplied as inline Name=Value pairs. Use this when you don't have a parameters file. Pass an array for multiple values. Values are parsed as JSON when possible, and otherwise treated as strings. Inline values overlay same-named keys from -ParametersFile and cannot be combined with -ParametersUri.
Path to a local ARM/Bicep parameters file (*.parameters.json or *.bicepparam). A .bicepparam file names its own template through its using declaration, so no template parameter is needed alongside it.
Optional SAS token or query string sent on the template link. Requires -TemplateUri.
A leading ? or & is removed. This value is not added to -ParametersUri.
The format of the what-if results. Use FullResourcePayloads (default) to include the full predicted resource bodies, or ResourceIdOnly for a compact list of affected resource IDs.
Resource ID of an existing template spec version to evaluate (for example, /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{name}/versions/{version}).
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
A WhatIfOperationResult describing the changes the deployment would apply if executed. No resources are created or modified; the caller can inspect the change list before running the real deployment.
Notes
What-if is a read-only preview: it never creates or modifies resources. As in Az.Resources, the preview always uses Incremental mode, so there is no -Mode parameter. Use New-AzSubDeployment to apply the changes once the preview looks correct.
Differences from Az.Resources: the parameters -ExcludeChangeType, -TemplateParameterObject, -Pre, and -SkipTemplateParameterPrompt are not supported. The legacy name Get-AzSubscriptionDeploymentWhatIfResult and the parameter names -DeploymentName, -TemplateParameterFile, and -TemplateParameterUri are accepted as aliases.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.