你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Test-AzResourceGroupDeployment
Validates a resource group deployment.
Syntax
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateFile <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterObject <Hashtable>
-TemplateObject <Hashtable>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterObject <Hashtable>
-TemplateFile <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterObject <Hashtable>
-TemplateUri <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterObject <Hashtable>
-TemplateSpecId <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterFile <String>
-TemplateObject <Hashtable>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterFile <String>
-TemplateFile <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterFile <String>
-TemplateUri <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterFile <String>
-TemplateSpecId <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterFile <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterUri <String>
-TemplateObject <Hashtable>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterUri <String>
-TemplateFile <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterUri <String>
-TemplateUri <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateParameterUri <String>
-TemplateSpecId <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateObject <Hashtable>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateUri <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Test-AzResourceGroupDeployment
-ResourceGroupName <String>
[-Mode <DeploymentMode>]
[-RollbackToLastDeployment]
[-RollBackDeploymentName <String>]
[-QueryString <String>]
-TemplateSpecId <String>
[-SkipTemplateParameterPrompt]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Test-AzResourceGroupDeployment cmdlet determines whether an Azure resource group deployment template and its parameter values are valid.
Examples
Example 1: Test deployment with a custom template object and parameter file
$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"
This command tests a deployment in the given resource group using the an in-memory hashtable created from the given template file and a parameter file.
Example 2: Test deployment via template file and parameter file
Test-AzResourceGroupDeployment -ResourceGroupName testRG01 -TemplateFile "D:\Azure\Templates\sampleDeploymentTemplate.json" -TemplateParameterFile "D:\Azure\Templates\sampleDeploymentTemplateParams.json"
This command tests a deployment in the given resource group and resource using the provided template file and a parameter file.
Example 3: Use a .bicepparam file to validate a deployment
Test-AzResourceGroupDeployment -ResourceGroupName "myRG1" -TemplateParameterFile "./parameters.bicepparam"
This command validates the deployment at the resource group 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
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Mode
Specifies the deployment mode. The acceptable values for this parameter are:
- Incremental
- Complete
Type: | DeploymentMode |
Accepted values: | Incremental, Complete |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Pre
Indicates that this cmdlet considers pre-release API versions when it automatically determines which version to use.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-QueryString
The query string (for example, a SAS token) to be used with the TemplateUri parameter. Would be used in case of linked templates
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceGroupName
Specifies the name of the resource group to test.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-RollBackDeploymentName
Rollback to the successful deployment with the given name in the resource group, should not be used if -RollbackToLastDeployment is used.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-RollbackToLastDeployment
Rollback to the last successful deployment in the resource group, should not be present if -RollBackDeploymentName is used.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-TemplateFile
Specifies the full path of a template file. Supported template file type: json and bicep.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateObject
A hash table which represents the template.
Type: | Hashtable |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateParameterFile
Specifies the full path of a JSON file that contains the names and values of the template parameters.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateParameterObject
Specifies a hash table of template parameter names and values.
Type: | Hashtable |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateParameterUri
Specifies the URI of a template parameters file.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateSpecId
Resource ID of the templateSpec to be deployed.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateUri
Specifies the URI of a template file.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |