Test-AzResourceGroupDeployment
语法
ByTemplateFileWithNoParameters (默认值)
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateFile <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateObjectAndParameterObject
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterObject <Hashtable>
-TemplateObject <Hashtable>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateFileAndParameterObject
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterObject <Hashtable>
-TemplateFile <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateUriAndParameterObject
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterObject <Hashtable>
-TemplateUri <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateSpecResourceIdAndParamsObject
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterObject <Hashtable>
-TemplateSpecId <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateObjectAndParameterFile
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterFile <String>
-TemplateObject <Hashtable>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateFileAndParameterFile
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterFile <String>
-TemplateFile <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateUriAndParameterFile
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterFile <String>
-TemplateUri <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateSpecResourceIdAndParams
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterFile <String>
-TemplateSpecId <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByParameterFileWithNoTemplate
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterFile <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateObjectAndParameterUri
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterUri <String>
-TemplateObject <Hashtable>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateFileAndParameterUri
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterUri <String>
-TemplateFile <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateUriAndParameterUri
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterUri <String>
-TemplateUri <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateSpecResourceIdAndParamsUri
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateParameterUri <String>
-TemplateSpecId <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateObjectWithNoParameters
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateObject <Hashtable>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateUriWithNoParameters
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateUri <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTemplateSpecResourceId
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
-TemplateSpecId <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
[-ValidationLevel <String>]
[-SuppressDiagnostics]
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
Test-AzResourceGroupDeployment cmdlet 确定 Azure 资源组部署模板及其参数值是否有效。
示例
示例 1:使用自定义模板对象和参数文件测试部署
$TemplateFileText = [System.IO.File]::ReadAllText("D:\Azure\Templates\EngineeringSite.json")
$TemplateObject = ConvertFrom-Json $TemplateFileText -AsHashtable
Test-AzResourceGroupDeployment -ResourceGroupName "ContosoEngineering" -TemplateObject $TemplateObject -TemplateParameterFile "D:\Azure\Templates\EngSiteParams.json"
此命令使用从给定模板文件和参数文件创建的内存中哈希表测试给定资源组中的部署。
示例 2:通过模板文件和参数文件测试部署
Test-AzResourceGroupDeployment -ResourceGroupName testRG01 -TemplateFile "D:\Azure\Templates\sampleDeploymentTemplate.json" -TemplateParameterFile "D:\Azure\Templates\sampleDeploymentTemplateParams.json"
此命令使用提供的模板文件和参数文件测试给定资源组和资源中的部署。
示例 3:使用 .bicepparam 文件验证部署
Test-AzResourceGroupDeployment -ResourceGroupName "myRG1" -TemplateParameterFile "./parameters.bicepparam"
此命令使用磁盘上的 .bicepparam 文件验证资源组范围内的部署。
该命令使用 TemplateParameterFile 参数指定 .bicepparam 文件。
参数
-DefaultProfile
用于与 azure 通信的凭据、帐户、租户和订阅
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Mode
指定部署模式。
此参数的可接受值为:
参数属性
类型: | DeploymentMode
|
默认值: | None |
接受的值: | Incremental, Complete |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-Pre
指示此 cmdlet 在自动确定要使用的版本时会考虑预发布 API 版本。
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-QueryString
要与 TemplateUri 参数一起使用的查询字符串(例如 SAS 令牌)。 在链接模板的情况下使用
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-ResourceGroupName
指定要测试的资源组的名称。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-RollBackDeploymentName
如果使用 -RollbackToLastDeployment,则不应使用资源组中具有给定名称的成功部署。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-RollbackToLastDeployment
如果使用 -RollBackDeploymentName,则不应在资源组中回滚到最后一个成功的部署。
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-SkipTemplateParameterPrompt
跳过 PowerShell 动态参数处理,用于检查提供的模板参数是否包含模板使用的所有必要参数。 此检查将提示用户提供缺失参数的值,但提供 -SkipTemplateParameterPrompt 会立即忽略此提示,如果发现参数未在模板中绑定,则会立即出错。 对于非交互式脚本,可以提供 -SkipTemplateParameterPrompt,以便在未满足所有必需参数的情况下提供更好的错误消息。
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-SuppressDiagnostics
设置后,不会为有效部署显示验证诊断。
参数属性
参数集
(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
表示模板的哈希表。
参数属性
参数集
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
指定包含模板参数名称和值的 JSON 文件的完整路径。
参数属性
类型: | 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
指定模板参数名称和值的哈希表。
参数属性
参数集
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(Provider) |
支持通配符: | 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。
Microsoft.Azure.Management.ResourceManager.Models.DeploymentMode
输出