你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Get-AzDeploymentWhatIfResult

获取订阅范围内部署的模板 What-If 结果。

语法

ByTemplateFileWithNoParameters (默认值)

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

说明

Get-AzDeploymentWhatIfResult cmdlet 获取当前订阅范围内模板部署的 ARM 模板 What-If 结果。 它返回一个更改列表,指示如果部署应用了哪些资源,而不对实际资源进行任何更改,则会更新哪些资源。 若要指定返回结果的格式,请使用 ResultFormat 参数。

示例

示例 1:获取订阅范围内的 What-If 结果

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

此命令通过使用自定义模板文件和磁盘上的参数文件在当前订阅范围内获取 What-If 结果。 该命令使用 Location 参数指定存储部署数据的位置。 该命令使用 TemplateFile 参数指定模板文件。 该命令使用 TemplateParameterFile 参数指定模板参数文件。 该命令使用 ResultFormat 参数设置 What-If 结果以包含完整的资源有效负载。

示例 2:使用 ResourceIdOnly 在订阅范围内获取 What-If 结果

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

此命令通过使用自定义模板文件和磁盘上的参数文件在当前订阅范围内获取 What-If 结果。 该命令使用 Location 参数指定存储部署数据的位置。 该命令使用 TemplateFile 参数指定模板文件。 该命令使用 TemplateParameterFile 参数指定模板参数文件。 该命令使用 ResultFormat 参数将 What-If 结果设置为仅包含资源 ID。

示例 3:使用 .bicepparam 文件计算 What-If

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

此命令通过在磁盘上使用 .bicepparam 文件获取当前订阅范围内的 What-If 结果。 该命令使用 TemplateParameterFile 参数指定 .bicepparam 文件。

参数

-DefaultProfile

用于与 Azure 通信的凭据、帐户、租户和订阅。

参数属性

类型:IAzureContextContainer
默认值:None
支持通配符:False
不显示:False
别名:AzContext, AzureRmContext, AzureCredential

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ExcludeChangeType

要从 What-If 结果中排除的资源更改类型的逗号分隔列表。

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Location

用于存储部署数据的位置。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Name

要创建的部署的名称。 如果未指定,则提供模板文件时默认为模板文件名;默认为提供模板对象的当前时间,例如“20131223140835”。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False
别名:部署名称

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Pre

设置时,指示 cmdlet 应在自动确定要使用的版本时使用预发布 API 版本。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ResultFormat

What-If 结果格式。

参数属性

类型:WhatIfResultFormat
默认值:None
接受的值:ResourceIdOnly, FullResourcePayloads
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-SkipTemplateParameterPrompt

跳过 PowerShell 动态参数处理,用于检查提供的模板参数是否包含模板使用的所有必要参数。 此检查将提示用户提供缺失参数的值,但提供 -SkipTemplateParameterPrompt 会立即忽略此提示,如果发现参数未在模板中绑定,则会立即出错。 对于非交互式脚本,可以提供 -SkipTemplateParameterPrompt,以便在未满足所有必需参数的情况下提供更好的错误消息。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-TemplateFile

模板文件的本地路径。 支持的模板文件类型:json 和 bicep。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByTemplateFileWithNoParameters
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateFileAndParameterObject
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateFileAndParameterFile
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateFileAndParameterUri
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-TemplateObject

表示模板的哈希表。

参数属性

类型:Hashtable
默认值:None
支持通配符:False
不显示:False

参数集

ByTemplateObjectAndParameterObject
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateObjectAndParameterFile
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateObjectAndParameterUri
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateObjectWithNoParameters
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-TemplateParameterFile

要用于模板的参数文件。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByTemplateObjectAndParameterFile
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateFileAndParameterFile
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateUriAndParameterFile
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateSpecResourceIdAndParams
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByParameterFileWithNoTemplate
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-TemplateParameterObject

表示参数的哈希表。

参数属性

类型:Hashtable
默认值:None
支持通配符:False
不显示:False

参数集

ByTemplateObjectAndParameterObject
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateFileAndParameterObject
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateUriAndParameterObject
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateSpecResourceIdAndParamsObject
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-TemplateParameterUri

模板参数文件的 URI。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByTemplateObjectAndParameterUri
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateFileAndParameterUri
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateUriAndParameterUri
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateSpecResourceIdAndParamsUri
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-TemplateSpecId

要部署的 templateSpec 的资源 ID。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByTemplateSpecResourceIdAndParamsObject
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateSpecResourceIdAndParams
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateSpecResourceIdAndParamsUri
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateSpecResourceId
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-TemplateUri

模板文件的 URI。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByTemplateUriAndParameterObject
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateUriAndParameterFile
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateUriAndParameterUri
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False
ByTemplateUriWithNoParameters
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-ValidationLevel

设置 validate/what-if 的验证级别。 ValidationLevel 可以是 Template(跳过提供程序验证)、Provider(执行完全验证)或 ProviderNoRbac(使用 RBAC 读取检查而不是 RBAC 写入检查进行提供程序验证)执行完全验证。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters

输入

Hashtable

String

输出

PSWhatIfOperationResult