Edit

Share via


Get-AzDeploymentWhatIfResult

Gets a template What-If result for a deployment at subscription scope.

Syntax

ByTemplateFileWithNoParameters (Default)

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateFile <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateObjectAndParameterObject

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterObject <Hashtable>
    -TemplateObject <Hashtable>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateFileAndParameterObject

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterObject <Hashtable>
    -TemplateFile <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateUriAndParameterObject

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterObject <Hashtable>
    -TemplateUri <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateSpecResourceIdAndParamsObject

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterObject <Hashtable>
    -TemplateSpecId <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateObjectAndParameterFile

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterFile <String>
    -TemplateObject <Hashtable>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateFileAndParameterFile

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterFile <String>
    -TemplateFile <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateUriAndParameterFile

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterFile <String>
    -TemplateUri <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateSpecResourceIdAndParams

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterFile <String>
    -TemplateSpecId <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByParameterFileWithNoTemplate

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterFile <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateObjectAndParameterUri

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterUri <String>
    -TemplateObject <Hashtable>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateFileAndParameterUri

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterUri <String>
    -TemplateFile <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateUriAndParameterUri

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterUri <String>
    -TemplateUri <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateSpecResourceIdAndParamsUri

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateParameterUri <String>
    -TemplateSpecId <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateObjectWithNoParameters

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateObject <Hashtable>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateUriWithNoParameters

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateUri <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByTemplateSpecResourceId

Get-AzDeploymentWhatIfResult
    -Location <String>
    -TemplateSpecId <String>
    [-Name <String>]
    [-ResultFormat <WhatIfResultFormat>]
    [-ExcludeChangeType <String[]>]
    [-ValidationLevel <String>]
    [-SkipTemplateParameterPrompt]
    [-Pre]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Get-AzDeploymentWhatIfResult cmdlet gets the ARM template What-If result for a template deployment at the current subscription scope. It returns a list of changes indicating what resources will be updated if the deployment is applied without making any changes to real resources. To specify the format for the returning result, use the ResultFormat parameter.

Examples

Example 1: Get a What-If result at subscription scope

Get-AzDeploymentWhatIfResult `
    -DeploymentName "deploy-01" `
    -Location "West US" `
    -TemplateFile "D:\Azure\Templates\ServiceTemplate.json" `
    -TemplateParameterFile "D:\Azure\Templates\ServiceParameters.json" `
    -ResultFormat "FullResourcePayloads"

This command gets a What-If result at the current subscription scope by using a custom template file and a parameter file on disk. The command uses the Location parameter to specify where to store the deployment data. The command uses the TemplateFile parameter to specify a template file. The command uses the TemplateParameterFile parameter to specify a template parameter file. The command uses the ResultFormat parameter to set the What-If result to include full resource payloads.

Example 2: Get a What-If result at subscription scope with ResourceIdOnly

Get-AzDeploymentWhatIfResult `
    -DeploymentName "deploy-01" `
    -Location "West US" `
    -TemplateFile "D:\Azure\Templates\ServiceTemplate.json" `
    -TemplateParameterFile "D:\Azure\Templates\ServiceParameters.json" `
    -ResultFormat "ResourceIdOnly"

This command gets a What-If result at the current subscription scope by using a custom template file and a parameter file on disk. The command uses the Location parameter to specify where to store the deployment data. The command uses the TemplateFile parameter to specify a template file. The command uses the TemplateParameterFile parameter to specify a template parameter file. The command uses the ResultFormat parameter to set the What-If result to only contain resource IDs.

Example 3: Use a .bicepparam file to calculate What-If

Get-AzDeploymentWhatIfResult -Location "West US" -TemplateParameterFile "./parameters.bicepparam"

This command gets a What-If result at the current subscription scope by using a .bicepparam file on disk. The command uses the TemplateParameterFile parameter to specify a .bicepparam file.

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ExcludeChangeType

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

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Location

The location to store deployment data.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

The name of the deployment it's going to create. If not specified, defaults to the template file name when a template file is provided; defaults to the current time when a template object is provided, e.g. "20131223140835".

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:DeploymentName

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Pre

When set, indicates that the cmdlet should use pre-release API versions when automatically determining which version to use.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResultFormat

The What-If result format.

Parameter properties

Type:WhatIfResultFormat
Default value:None
Accepted values:ResourceIdOnly, FullResourcePayloads
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SkipTemplateParameterPrompt

Skips the PowerShell dynamic parameter processing that checks if the provided template parameter contains all necessary parameters used by the template. This check would prompt the user to provide a value for the missing parameters, but providing the -SkipTemplateParameterPrompt will ignore this prompt and error out immediately if a parameter was found not to be bound in the template. For non-interactive scripts, -SkipTemplateParameterPrompt can be provided to provide a better error message in the case where not all required parameters are satisfied.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TemplateFile

Local path to the template file. Supported template file type: json and bicep.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByTemplateFileWithNoParameters
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateFileAndParameterObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateFileAndParameterFile
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateFileAndParameterUri
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TemplateObject

A hash table which represents the template.

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByTemplateObjectAndParameterObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateObjectAndParameterFile
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateObjectAndParameterUri
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateObjectWithNoParameters
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TemplateParameterFile

Parameter file to use for the template.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByTemplateObjectAndParameterFile
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateFileAndParameterFile
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateUriAndParameterFile
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateSpecResourceIdAndParams
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByParameterFileWithNoTemplate
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TemplateParameterObject

A hash table which represents the parameters.

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByTemplateObjectAndParameterObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateFileAndParameterObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateUriAndParameterObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateSpecResourceIdAndParamsObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TemplateParameterUri

Uri to the template parameter file.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByTemplateObjectAndParameterUri
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateFileAndParameterUri
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateUriAndParameterUri
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateSpecResourceIdAndParamsUri
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TemplateSpecId

Resource ID of the templateSpec to be deployed.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByTemplateSpecResourceIdAndParamsObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateSpecResourceIdAndParams
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateSpecResourceIdAndParamsUri
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateSpecResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TemplateUri

Uri to the template file.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByTemplateUriAndParameterObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateUriAndParameterFile
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateUriAndParameterUri
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ByTemplateUriWithNoParameters
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ValidationLevel

Sets the validation level for validate/what-if. ValidationLevel can be Template(Skips provider validation), Provider(Performs full validation), or ProviderNoRbac(Performs full validation using RBAC read checks instead of RBAC write checks for provider validation).

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

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.

Inputs

Hashtable

String

Outputs

PSWhatIfOperationResult