Modifier

Partager via


Add-AzSqlElasticJobTarget

Adds a target to a target group

Syntax

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

Description

The Add-AzSqlElasticJobTarget cmdlet adds a target resource to a target group

Examples

Example 1: Add a server target

$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

Example 2: Add a database target

$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

Example 3: Add an elastic pool target

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

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

Example 4: Add a shard map target

$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

Adds a target (server, elastic pool, database, and shard map) to a target group

Parameters

-AgentName

The agent name.

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

-AgentServerName

The server name.

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

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DatabaseName

Database Target Name

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

-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

-ElasticPoolName

Elastic Pool Target Name

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

-Exclude

Excludes a target.

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

-ParentObject

The target group object.

Type:AzureSqlElasticJobTargetGroupModel
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ParentResourceId

The target group resource id.

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

-RefreshCredentialName

Refresh Credential Name

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

-ResourceGroupName

Resource Group Name

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

-ServerName

Server Target Name

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

-ShardMapName

Shard Map Target Name

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

-TargetGroupName

The target group name.

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

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

Inputs

AzureSqlElasticJobTargetGroupModel

Outputs

JobTarget