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

New-AzTenantDeployment

在租户范围内创建部署

语法

New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateFile <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterObject <Hashtable>
   -TemplateObject <Hashtable>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterObject <Hashtable>
   -TemplateFile <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterObject <Hashtable>
   -TemplateUri <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterObject <Hashtable>
   -TemplateSpecId <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterFile <String>
   -TemplateObject <Hashtable>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterFile <String>
   -TemplateFile <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterFile <String>
   -TemplateUri <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterFile <String>
   -TemplateSpecId <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterFile <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterUri <String>
   -TemplateObject <Hashtable>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterUri <String>
   -TemplateFile <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterUri <String>
   -TemplateUri <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateParameterUri <String>
   -TemplateSpecId <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateObject <Hashtable>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateUri <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTenantDeployment
   [-Name <String>]
   -Location <String>
   [-DeploymentDebugLogLevel <String>]
   [-Tag <Hashtable>]
   [-WhatIfResultFormat <WhatIfResultFormat>]
   [-WhatIfExcludeChangeType <String[]>]
   [-ProceedIfNoChange]
   [-AsJob]
   [-QueryString <String>]
   -TemplateSpecId <String>
   [-SkipTemplateParameterPrompt]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

说明

New-AzTenantDeployment cmdlet 在当前租户范围内添加部署。

若要在租户范围内添加部署,请指定位置和模板。 该位置告知 Azure 资源管理器存储部署数据的位置。 模板是一个 JSON 字符串,其中包含要部署的各个资源。 该模板包括所需资源和可配置属性值的参数占位符,例如名称和大小。

若要对部署使用自定义模板,请指定 TemplateFile 参数或 TemplateUri 参数。 每个模板都有可配置属性的参数。 若要指定模板参数的值,请指定 TemplateParameterFile 参数或 TemplateParameterObject 参数。 或者,可以在指定模板时使用动态添加到命令的模板参数。 若要使用动态参数,请在命令提示符下键入它们,或键入减号(-),以指示参数,并使用 Tab 键循环访问可用参数。 在命令提示符处输入的模板参数值优先于模板参数对象或文件中的值。

若要将资源添加到资源组,请使用在资源组中创建部署的 New-AzResourceGroupDeployment 。 若要将资源添加到订阅,请使用 New-AzSubscriptionDeployment ,用于在订阅范围内创建部署,该部署订阅级别资源。 若要在管理组中添加资源,请使用 New-AzManagementGroupDeployment, 用于在管理组中创建部署。

示例

示例 1:使用自定义模板和参数文件创建部署

New-AzTenantDeployment -Location "West US" -TemplateFile "D:\Azure\Templates\OrgSetup.json" -TemplateParameterFile "D:\Azure\Templates\OrgParms.json" -Tag @{"key1"="value1"; "key2"="value2";}

此命令使用自定义模板和磁盘上的模板文件(具有定义的标记参数)在当前租户范围内创建新的部署。 该命令使用 TemplateFile 参数来指定模板,并使用 TemplateParameterFile 参数指定包含参数和参数值的文件 。

示例 2:使用自定义模板对象和参数文件创建部署

$TemplateFileText = [System.IO.File]::ReadAllText("D:\Azure\Templates\OrgSetup.json")
$TemplateObject = ConvertFrom-Json $TemplateFileText -AsHashtable
New-AzTenantDeployment -Location "West US" -TemplateObject $TemplateObject -TemplateParameterFile "D:\Azure\Templates\OrgParams.json"

此命令使用自定义模板和磁盘上已转换为内存中哈希表的模板文件,在当前租户上创建新的部署。 前两个命令读取磁盘上模板文件的文本,并将其转换为内存中哈希表。 最后一个命令使用 TemplateObject 参数指定此哈希表和 TemplateParameterFile 参数来指定包含参数和参数值的文件。

示例 3:使用 .bicepparam 文件创建部署

New-AzTenantDeployment -Location "West US" -TemplateParameterFile "./parameters.bicepparam"

此命令使用磁盘上的 .bicepparam 文件在当前租户范围内创建新的部署。 该命令使用 TemplateParameterFile 参数指定 .bicepparam 文件。

参数

-AsJob

在后台运行 cmdlet

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

提示你在运行 cmdlet 之前进行确认。

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DeploymentDebugLogLevel

部署调试日志级别。

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Location

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

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

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

Type:String
Aliases:DeploymentName
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Pre

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ProceedIfNoChange

请勿要求确认 What-If 结果中是否有任何更改。 在设置 -Confirm 开关时适用。

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-QueryString

要与 TemplateUri 参数一起使用的查询字符串(例如 SAS 令牌)。 在链接模板的情况下使用

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SkipTemplateParameterPrompt

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Tag

要放入部署的标记。

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TemplateFile

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

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateObject

表示模板的哈希表。

Type:Hashtable
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateParameterFile

要用于模板的参数文件。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateParameterObject

表示参数的哈希表。

Type:Hashtable
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateParameterUri

模板参数文件的 URI。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateSpecId

要部署的 templateSpec 的资源 ID。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateUri

模板文件的 URI。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

显示运行该 cmdlet 时会发生什么情况。 cmdlet 未运行。

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIfExcludeChangeType

要从 What-If 结果中排除的逗号分隔的资源更改类型。 在设置 -WhatIf 或 -Confirm 开关时适用。

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIfResultFormat

What-If 结果格式。 在设置 -WhatIf 或 -Confirm 开关时适用。

Type:WhatIfResultFormat
Accepted values:ResourceIdOnly, FullResourcePayloads
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

输入

Hashtable

String

输出

PSDeployment