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

Job Target Groups - Create Or Update

创建或更新目标组。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}?api-version=2021-08-01-preview

URI 参数

Name In Required Type Description
jobAgentName
path True
  • string

作业代理的名称。

resourceGroupName
path True
  • string

包含该资源的资源组名称。 可以从 Azure 资源管理器 API 或门户获取此值。

serverName
path True
  • string

服务器的名称。

subscriptionId
path True
  • string

用于标识 Azure 订阅的订阅 ID。

targetGroupName
path True
  • string

目标组的名称。

api-version
query True
  • string

要用于请求的 API 版本。

请求正文

Name Required Type Description
properties.members True

目标组的成员。

响应

Name Type Description
200 OK

已成功更新目标组。

201 Created

已成功创建目标组。

Other Status Codes

错误响应: ***

  • 400 InvalidResourceRequestBody - 请求正文中的资源或资源属性为空或无效。

  • 400 InvalidResourceId - 资源标识符无效。

  • 400 不匹配SubscriptionWithUrl - 提供的订阅与 URL 中的订阅不匹配。

  • 400 不匹配ResourceGroupNameWithUrl - 提供的资源组名称与 URL 中的名称不匹配。

  • 400 不匹配ServerNameWithUrl - 提供的服务器名称与 URL 中的名称不匹配。

  • 400 不匹配JobAccountNameWithUrl - 提供的作业帐户名称与 URL 中的名称不匹配。

  • 400 ElasticJobsOperationFailed - 弹性作业管理操作失败。

  • 400 ElasticJobsOperationFailed - 弹性作业管理操作失败。

  • 404 JobAgentNotFound - 指定的作业代理在指定的逻辑服务器中不存在。

  • 404 SubscriptionDoesNotHaveServer - 找不到请求的服务器

  • 404 ServerNotInSubscriptionResourceGroup - 指定的服务器不存在于指定的资源组和订阅中。

示例

Create or update a target group with all properties.
Create or update a target group with minimal properties.

Create or update a target group with all properties.

Sample Request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1?api-version=2021-08-01-preview

{
  "properties": {
    "members": [
      {
        "membershipType": "Exclude",
        "type": "SqlDatabase",
        "serverName": "server1",
        "databaseName": "database1"
      },
      {
        "membershipType": "Include",
        "type": "SqlServer",
        "serverName": "server1",
        "refreshCredential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"
      },
      {
        "membershipType": "Include",
        "type": "SqlElasticPool",
        "serverName": "server2",
        "elasticPoolName": "pool1",
        "refreshCredential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"
      },
      {
        "membershipType": "Include",
        "type": "SqlShardMap",
        "serverName": "server3",
        "shardMapName": "shardMap1",
        "refreshCredential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"
      }
    ]
  }
}

Sample Response

{
  "properties": {
    "members": [
      {
        "membershipType": "Exclude",
        "type": "SqlDatabase",
        "serverName": "server1",
        "databaseName": "database1"
      },
      {
        "membershipType": "Include",
        "type": "SqlServer",
        "serverName": "server1",
        "refreshCredential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"
      },
      {
        "membershipType": "Include",
        "type": "SqlElasticPool",
        "serverName": "server2",
        "elasticPoolName": "pool1",
        "refreshCredential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"
      },
      {
        "membershipType": "Include",
        "type": "SqlShardMap",
        "serverName": "server3",
        "shardMapName": "shardMap1",
        "refreshCredential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"
      }
    ]
  },
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1",
  "name": "targetGroup1",
  "type": "Microsoft.Sql/servers/jobAgents/targetGroups"
}
{
  "properties": {
    "members": [
      {
        "membershipType": "Exclude",
        "type": "SqlDatabase",
        "serverName": "server1",
        "databaseName": "database1"
      },
      {
        "membershipType": "Include",
        "type": "SqlServer",
        "serverName": "server1",
        "refreshCredential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"
      },
      {
        "membershipType": "Include",
        "type": "SqlElasticPool",
        "serverName": "server2",
        "elasticPoolName": "pool1",
        "refreshCredential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"
      },
      {
        "membershipType": "Include",
        "type": "SqlShardMap",
        "serverName": "server3",
        "shardMapName": "shardMap1",
        "refreshCredential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"
      }
    ]
  },
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1",
  "name": "targetGroup1",
  "type": "Microsoft.Sql/servers/jobAgents/targetGroups"
}

Create or update a target group with minimal properties.

Sample Request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1?api-version=2021-08-01-preview

{
  "properties": {
    "members": []
  }
}

Sample Response

{
  "properties": {
    "members": []
  },
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1",
  "name": "targetGroup1",
  "type": "Microsoft.Sql/servers/jobAgents/targetGroups"
}
{
  "properties": {
    "members": []
  },
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1",
  "name": "targetGroup1",
  "type": "Microsoft.Sql/servers/jobAgents/targetGroups"
}

定义

JobTarget

作业目标,例如,在作业执行期间评估的特定数据库或数据库的容器。

JobTargetGroup

一组作业目标。

JobTargetGroupMembershipType

目标是包含还是从组中排除。

JobTargetType

目标类型。

JobTarget

作业目标,例如,在作业执行期间评估的特定数据库或数据库的容器。

Name Type Default Value Description
databaseName
  • string

目标数据库名称。

elasticPoolName
  • string

目标弹性池名称。

membershipType Include

目标是包含还是从组中排除。

refreshCredential
  • string

作业执行期间用于连接到目标并确定目标内数据库列表的凭据的资源 ID。

serverName
  • string

目标服务器名称。

shardMapName
  • string

目标分片映射。

type

目标类型。

JobTargetGroup

一组作业目标。

Name Type Description
id
  • string

资源 ID。

name
  • string

资源名称。

properties.members

目标组的成员。

type
  • string

资源类型。

JobTargetGroupMembershipType

目标是包含还是从组中排除。

Name Type Description
Exclude
  • string
Include
  • string

JobTargetType

目标类型。

Name Type Description
SqlDatabase
  • string
SqlElasticPool
  • string
SqlServer
  • string
SqlShardMap
  • string
TargetGroup
  • string