Edit

Share via


Add-AzSqlElasticJobTarget

Adds a target to a target group

Syntax

SqlDatabase (Default)

Add-AzSqlElasticJobTarget
    [-ResourceGroupName] <String>
    [-AgentServerName] <String>
    [-AgentName] <String>
    [-TargetGroupName] <String>
    -ServerName <String>
    -DatabaseName <String>
    [-Exclude]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SqlServerOrElasticPool

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

SqlShardMap

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

SqlDatabaseUsingParentObject

Add-AzSqlElasticJobTarget
    [-ParentObject] <AzureSqlElasticJobTargetGroupModel>
    -ServerName <String>
    -DatabaseName <String>
    [-Exclude]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SqlServerOrElasticPoolUsingParentObject

Add-AzSqlElasticJobTarget
    [-ParentObject] <AzureSqlElasticJobTargetGroupModel>
    -ServerName <String>
    [-Exclude]
    [-ElasticPoolName <String>]
    [-RefreshCredentialName <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SqlShardMapUsingParentObject

Add-AzSqlElasticJobTarget
    [-ParentObject] <AzureSqlElasticJobTargetGroupModel>
    -ServerName <String>
    -ShardMapName <String>
    -DatabaseName <String>
    [-Exclude]
    [-RefreshCredentialName <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SqlDatabaseUsingParentResourceId

Add-AzSqlElasticJobTarget
    [-ParentResourceId] <String>
    -ServerName <String>
    -DatabaseName <String>
    [-Exclude]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SqlServerOrElasticPoolUsingParentResourceId

Add-AzSqlElasticJobTarget
    [-ParentResourceId] <String>
    -ServerName <String>
    [-Exclude]
    [-ElasticPoolName <String>]
    [-RefreshCredentialName <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SqlShardMapUsingParentResourceId

Add-AzSqlElasticJobTarget
    [-ParentResourceId] <String>
    -ServerName <String>
    -ShardMapName <String>
    -DatabaseName <String>
    [-Exclude]
    [-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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlDatabase
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlServerOrElasticPool
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlShardMap
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AgentServerName

The server name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlDatabase
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlServerOrElasticPool
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlShardMap
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DatabaseName

Database Target Name

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlDatabase
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlShardMap
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlDatabaseUsingParentObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlShardMapUsingParentObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlDatabaseUsingParentResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlShardMapUsingParentResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ElasticPoolName

Elastic Pool Target Name

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlServerOrElasticPool
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlServerOrElasticPoolUsingParentObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlServerOrElasticPoolUsingParentResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Exclude

Excludes a target.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ParentObject

The target group object.

Parameter properties

Type:AzureSqlElasticJobTargetGroupModel
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlDatabaseUsingParentObject
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
SqlServerOrElasticPoolUsingParentObject
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
SqlShardMapUsingParentObject
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-ParentResourceId

The target group resource id.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlDatabaseUsingParentResourceId
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlServerOrElasticPoolUsingParentResourceId
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlShardMapUsingParentResourceId
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-RefreshCredentialName

Refresh Credential Name

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlServerOrElasticPool
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlShardMap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlServerOrElasticPoolUsingParentObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlShardMapUsingParentObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlServerOrElasticPoolUsingParentResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlShardMapUsingParentResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

Resource Group Name

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlDatabase
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlServerOrElasticPool
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlShardMap
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ServerName

Server Target Name

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlDatabase
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlShardMap
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlDatabaseUsingParentObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlServerOrElasticPoolUsingParentObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlShardMapUsingParentObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlDatabaseUsingParentResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlServerOrElasticPoolUsingParentResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlShardMapUsingParentResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ShardMapName

Shard Map Target Name

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlShardMap
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlShardMapUsingParentObject
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SqlShardMapUsingParentResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TargetGroupName

The target group name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlDatabase
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlServerOrElasticPool
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
SqlShardMap
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

AzureSqlElasticJobTargetGroupModel

Outputs

JobTarget