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

Job Agents - Create Or Update

创建或更新作业代理。

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

URI 参数

名称 必需 类型 说明
jobAgentName
path True

string

要创建或更新的作业代理的名称。

resourceGroupName
path True

string

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

serverName
path True

string

服务器的名称。

subscriptionId
path True

string

标识 Azure 订阅的订阅 ID。

api-version
query True

string

要用于请求的 API 版本。

请求正文

名称 必需 类型 说明
location True

string

资源位置。

properties.databaseId True

string (arm-id)

要在其中存储作业元数据的数据库的资源 ID。

identity

JobAgentIdentity

作业代理的标识。

sku

Sku

SKU 的名称和层。

tags

object

资源标记。

响应

名称 类型 说明
200 OK

JobAgent

已成功更新作业代理。

201 Created

JobAgent

已成功创建作业代理。

202 Accepted

接受

标头

Location: string

Other Status Codes

ErrorResponse

错误响应: ***

  • 400 ManagedInstanceStoppingOrStopped - 实例处于停止/停止状态时提交的冲突作

  • 400 ManagedInstanceStarting - 实例处于启动状态时提交的冲突作

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

  • 400 MissingSkuName - Sku 名称是必需的。

  • 400 InvalidDatabaseResourceId - 数据库资源标识符无效。

  • 400 InvalidIdentityTenantId - 无法在创建或更新请求上指定 tenantId。

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

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

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

  • 400 MissingUserAssignedIdentities - identity.userAssignedIdentities 必须在 identity.type 等于“UserAssigned”时提供。

  • 400 MissingIdentityType - 请指定标识类型。

  • 400 MultipleIdentitiesOnJobAgent - 请为每个作业代理仅指定一个用户托管标识。

  • 400 InvalidIdentityType - 请仅指定“None”或“UserAssigned”标识类型。

  • 400 SkuMismatchingNameCapacity - 提供的 SKU 容量与提供的 SKU 名称不匹配。

  • 400 ElasticJobAgentEditionUnsupported - 作业代理不支持给定的 SLO。 请使用支持的 SLO 重试。

  • 400 ElasticJobAgentObjectiveAssignmentInProgress - 弹性作业代理{0}的 SLO 分配目前正在进行中。 请稍后重试作。

  • 400 ElasticJobAgentEditionUnsupported - 作业代理不支持给定的 SLO。 请使用支持的 SLO 重试。

  • 400 DatabaseDoesNotExist - 找不到请求的数据库

  • 400 JobAgentExceededQuota - 无法创建作业代理,因为它将超过配额。

  • 400 JobAgentAlreadyExists - 作业代理已存在于服务器上。

  • 400 JobAgentDatabaseEditionUnsupported - 不支持指定数据库的服务级别目标用作作业代理数据库。

  • 400 JobAgentDatabaseSecondary - 作业代理无法链接到异地辅助数据库。

  • 400 JobAgentDatabaseAlreadyLinked - 指定的数据库已链接到另一个作业代理。

  • 400 ElasticJobsNotSupportedOnAutoPauseEnabledDatabase - 不支持自动暂停的无服务器数据库作为弹性作业数据库,因为作业代理会阻止该数据库暂停。 可以在此无服务器数据库上禁用自动暂停,也可以删除使用此数据库的作业代理。 有关详细信息,请参阅此处:https://docs.microsoft.com/azure/azure-sql/database/serverless-tier-overview#auto-pausing

  • 400 CannotUseReservedDatabaseName - 不能在此作中使用保留的数据库名称。

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

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

  • 404 SubscriptionNotFound - 找不到请求的订阅。

  • 404 PropertyChangeUnsupported - 无法修改属性。

  • 404 OperationIdNotFound - ID作不存在。

  • 409 ServerDisabled - 服务器已禁用。

  • 409 ElasticJobAgentOperationUnavailable - 弹性作业代理{0}的作“{1}”被阻止,因为 {2}

  • 409 CannotCancelOperation - 管理作处于无法取消的状态。

  • 409 OperationCancelled -作已被用户取消。

  • 409 OperationInterrupted - 无法完成资源上的作,因为它被同一资源上的另一个作中断。

  • 429 SubscriptionTooManyCreateUpdateRequests - 请求超出可用资源可以处理的最大请求数。

  • 429 SubscriptionTooManyRequests - 请求超出可用资源可以处理的最大请求数。

  • 500 OperationTimedOut -作超时并自动回滚。 请重试该作。

  • 503 TooManyRequests - 请求超出可用资源可以处理的最大请求数。

示例

Create or update a job agent
Create or update a job agent with identity
Create or update a job agent with sku.

Create or update a job agent

示例请求

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

{
  "location": "southeastasia",
  "properties": {
    "databaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"
  }
}

示例响应

{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1",
  "name": "agent1",
  "type": "Microsoft.Sql/servers/jobAgents",
  "location": "southeastasia",
  "sku": {
    "name": "JA100",
    "capacity": 100
  },
  "properties": {
    "databaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"
  }
}
{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1",
  "name": "agent1",
  "type": "Microsoft.Sql/servers/jobAgents",
  "location": "southeastasia",
  "sku": {
    "name": "JA100",
    "capacity": 100
  },
  "properties": {
    "databaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"
  }
}

Create or update a job agent with identity

示例请求

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

{
  "location": "southeastasia",
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-umi": {}
    }
  },
  "properties": {
    "databaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"
  }
}

示例响应

{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1",
  "name": "agent1",
  "type": "Microsoft.Sql/servers/jobAgents",
  "location": "southeastasia",
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-umi": {
        "clientId": "0c29d9b7-0ae2-4014-96ea-faf8e0cf2bc7",
        "principalId": "0c29d9b7-0ae2-4014-96ea-faf8e0cf2bc7"
      }
    }
  },
  "properties": {
    "databaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"
  }
}
{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1",
  "name": "agent1",
  "type": "Microsoft.Sql/servers/jobAgents",
  "location": "southeastasia",
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-umi": {
        "clientId": "0c29d9b7-0ae2-4014-96ea-faf8e0cf2bc7",
        "principalId": "0c29d9b7-0ae2-4014-96ea-faf8e0cf2bc7"
      }
    }
  },
  "properties": {
    "databaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"
  }
}

Create or update a job agent with sku.

示例请求

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

{
  "location": "southeastasia",
  "sku": {
    "name": "JA400"
  },
  "properties": {
    "databaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"
  }
}

示例响应

{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1",
  "name": "agent1",
  "type": "Microsoft.Sql/servers/jobAgents",
  "location": "southeastasia",
  "sku": {
    "name": "JA400",
    "capacity": 400
  },
  "properties": {
    "databaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"
  }
}
{
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1",
  "name": "agent1",
  "type": "Microsoft.Sql/servers/jobAgents",
  "location": "southeastasia",
  "sku": {
    "name": "JA400",
    "capacity": 400
  },
  "properties": {
    "databaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"
  }
}

定义

名称 说明
ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ErrorResponse

错误响应

JobAgent

Azure SQL 作业代理。

JobAgentIdentity

资源的 Azure Active Directory 标识配置。

JobAgentIdentityType

作业代理标识类型

JobAgentState

作业代理的状态。

JobAgentUserAssignedIdentity

资源的 Azure Active Directory 标识配置。

Sku

ARM 资源 SKU。

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ErrorResponse

错误响应

名称 类型 说明
error

ErrorDetail

错误对象。

JobAgent

Azure SQL 作业代理。

名称 类型 说明
id

string

资源 ID。

identity

JobAgentIdentity

作业代理的标识。

location

string

资源位置。

name

string

资源名称。

properties.databaseId

string (arm-id)

要在其中存储作业元数据的数据库的资源 ID。

properties.state

JobAgentState

作业代理的状态。

sku

Sku

SKU 的名称和层。

tags

object

资源标记。

type

string

资源类型。

JobAgentIdentity

资源的 Azure Active Directory 标识配置。

名称 类型 说明
tenantId

string (uuid)

作业代理标识租户 ID

type

JobAgentIdentityType

作业代理标识类型

userAssignedIdentities

<string,  JobAgentUserAssignedIdentity>

要使用的用户分配标识的资源 ID

JobAgentIdentityType

作业代理标识类型

说明
None
SystemAssigned
SystemAssignedUserAssigned
UserAssigned

JobAgentState

作业代理的状态。

说明
Creating
Deleting
Disabled
Ready
Updating

JobAgentUserAssignedIdentity

资源的 Azure Active Directory 标识配置。

名称 类型 说明
clientId

string (uuid)

Azure Active Directory 客户端 ID。

principalId

string (uuid)

Azure Active Directory 主体 ID。

Sku

ARM 资源 SKU。

名称 类型 说明
capacity

integer (int32)

特定 SKU 的容量。

family

string

如果服务具有不同代的硬件(对于同一 SKU,则可以在此处捕获)。

name

string

SKU 的名称,通常为字母 + 数字代码,例如 P3。

size

string

特定 SKU 的大小

tier

string

特定 SKU 的层或版本,例如基本 SKU、高级版。