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

Add-AzSqlElasticJobTarget

将目标添加到目标组

语法

Add-AzSqlElasticJobTarget
   [-Exclude]
   [-ResourceGroupName] <String>
   [-AgentServerName] <String>
   [-AgentName] <String>
   [-TargetGroupName] <String>
   -ServerName <String>
   -DatabaseName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzSqlElasticJobTarget
   [-Exclude]
   [-ResourceGroupName] <String>
   [-AgentServerName] <String>
   [-AgentName] <String>
   [-TargetGroupName] <String>
   -ServerName <String>
   [-ElasticPoolName <String>]
   [-RefreshCredentialName <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzSqlElasticJobTarget
   [-Exclude]
   [-ResourceGroupName] <String>
   [-AgentServerName] <String>
   [-AgentName] <String>
   [-TargetGroupName] <String>
   -ServerName <String>
   -ShardMapName <String>
   -DatabaseName <String>
   [-RefreshCredentialName <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzSqlElasticJobTarget
   [-Exclude]
   [-ParentObject] <AzureSqlElasticJobTargetGroupModel>
   -ServerName <String>
   -DatabaseName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzSqlElasticJobTarget
   [-Exclude]
   [-ParentObject] <AzureSqlElasticJobTargetGroupModel>
   -ServerName <String>
   [-ElasticPoolName <String>]
   [-RefreshCredentialName <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzSqlElasticJobTarget
   [-Exclude]
   [-ParentObject] <AzureSqlElasticJobTargetGroupModel>
   -ServerName <String>
   -ShardMapName <String>
   -DatabaseName <String>
   [-RefreshCredentialName <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzSqlElasticJobTarget
   [-Exclude]
   [-ParentResourceId] <String>
   -ServerName <String>
   -DatabaseName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzSqlElasticJobTarget
   [-Exclude]
   [-ParentResourceId] <String>
   -ServerName <String>
   [-ElasticPoolName <String>]
   [-RefreshCredentialName <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzSqlElasticJobTarget
   [-Exclude]
   [-ParentResourceId] <String>
   -ServerName <String>
   -ShardMapName <String>
   -DatabaseName <String>
   [-RefreshCredentialName <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

说明

Add-AzSqlElasticJobTarget cmdlet 将目标资源添加到目标组

示例

示例 1:添加服务器目标

$tg = Get-AzSqlElasticJobTargetGroup -ResourceGroupName rg -ServerName elasticjobserver -Name tg1
$tg | Add-AzSqlElasticJobTarget -ServerName s1 -RefreshCredentialName cred1

TargetGroupName TargetType TargetServerName TargetDatabaseName TargetElasticPoolName TargetShardMapName RefreshCredentialName MembershipType
--------------- ---------- ---------------- ------------------ --------------------- ------------------ --------------------- --------------
tg1             SqlServer  s1                                                                           cred1                 Include

示例 2:添加数据库目标

$tg = Get-AzSqlElasticJobTargetGroup -ResourceGroupName rg -ServerName elasticjobserver -Name tg1
$tg | Add-AzSqlElasticJobTarget -ServerName s1 -DatabaseName db2

TargetGroupName TargetType  TargetServerName TargetDatabaseName TargetElasticPoolName TargetShardMapName RefreshCredentialName MembershipType
--------------- ----------  ---------------- ------------------ --------------------- ------------------ --------------------- --------------
tg1             SqlDatabase s1               db2                                                                               Include

示例 3:添加弹性池目标

$tg | Add-AzSqlElasticJobTarget -ServerName s1 -ElasticPoolName ep1 -RefreshCredentialName cred1

TargetGroupName TargetType     TargetServerName TargetDatabaseName TargetElasticPoolName TargetShardMapName RefreshCredentialName MembershipType
--------------- ----------     ---------------- ------------------ --------------------- ------------------ --------------------- --------------
tg1             SqlElasticPool s1                                  ep1                                      cred1                 Include

示例 4:添加分片映射目标

$tg = Get-AzSqlElasticJobTargetGroup -ResourceGroupName rg -ServerName elasticjobserver -Name tg1
$tg | Add-AzSqlElasticJobTarget -ServerName s1 -ShardMapName sm1 -DatabaseName db1 -RefreshCredentialName cred1

TargetGroupName TargetType  TargetServerName TargetDatabaseName TargetElasticPoolName TargetShardMapName RefreshCredentialName MembershipType
--------------- ----------  ---------------- ------------------ --------------------- ------------------ --------------------- --------------
tg1             SqlShardMap s1               db1                                      sm1                cred1                 Include

将目标(服务器、弹性池、数据库和分片映射)添加到目标组

参数

-AgentName

代理名称。

类型:String
Position:2
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-AgentServerName

服务器名称。

类型:String
Position:1
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-Confirm

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

类型:SwitchParameter
别名:cf
Position:Named
默认值:False
必需:False
接受管道输入:False
接受通配符:False

-DatabaseName

数据库目标名称

类型:String
Position:Named
默认值:None
必需:True
接受管道输入:True
接受通配符:False

-DefaultProfile

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

类型:IAzureContextContainer
别名:AzContext, AzureRmContext, AzureCredential
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-ElasticPoolName

弹性池目标名称

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:True
接受通配符:False

-Exclude

排除目标。

类型:SwitchParameter
Position:Named
默认值:False
必需:False
接受管道输入:False
接受通配符:False

-ParentObject

目标组对象。

类型:AzureSqlElasticJobTargetGroupModel
Position:0
默认值:None
必需:True
接受管道输入:True
接受通配符:False

-ParentResourceId

目标组资源 ID。

类型:String
Position:0
默认值:None
必需:True
接受管道输入:True
接受通配符:False

-RefreshCredentialName

刷新凭据名称

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-ResourceGroupName

资源组名称

类型:String
Position:0
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-ServerName

服务器目标名称

类型:String
Position:Named
默认值:None
必需:True
接受管道输入:True
接受通配符:False

-ShardMapName

分片映射目标名称

类型:String
Position:Named
默认值:None
必需:True
接受管道输入:True
接受通配符:False

-TargetGroupName

目标组名称。

类型:String
Position:3
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-WhatIf

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

类型:SwitchParameter
别名:wi
Position:Named
默认值:False
必需:False
接受管道输入:False
接受通配符:False

输入

AzureSqlElasticJobTargetGroupModel

输出

JobTarget