Share via


Job Agents - Create Or Update

Creates or updates a job agent.

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

URI Parameters

Name In Required Type Description
jobAgentName
path True

string

The name of the job agent to be created or updated.

resourceGroupName
path True

string

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

serverName
path True

string

The name of the server.

subscriptionId
path True

string

The subscription ID that identifies an Azure subscription.

api-version
query True

string

The API version to use for the request.

Request Body

Name Required Type Description
location True

string

Resource location.

properties.databaseId True

string (arm-id)

Resource ID of the database to store job metadata in.

identity

JobAgentIdentity

The identity of the job agent.

sku

Sku

The name and tier of the SKU.

tags

object

Resource tags.

Responses

Name Type Description
200 OK

JobAgent

Successfully updated the job agent.

201 Created

JobAgent

Successfully created the job agent.

202 Accepted

Accepted

Headers

Location: string

Other Status Codes

ErrorResponse

*** Error Responses: ***

  • 400 ManagedInstanceStoppingOrStopped - Conflicting operation submitted while instance is in stopping/stopped state

  • 400 ManagedInstanceStarting - Conflicting operation submitted while instance is in starting state

  • 400 InvalidResourceRequestBody - The resource or resource properties in the request body is empty or invalid.

  • 400 MissingSkuName - Sku name is required.

  • 400 InvalidDatabaseResourceId - Invalid database resource identifier.

  • 400 InvalidIdentityTenantId - tenantId cannot be specified on a create or update request.

  • 400 MismatchingSubscriptionWithUrl - The provided subscription did not match the subscription in the Url.

  • 400 MismatchingResourceGroupNameWithUrl - The provided resource group name did not match the name in the Url.

  • 400 MismatchingServerNameWithUrl - The provided server name did not match the name in the Url.

  • 400 MissingUserAssignedIdentities - identity.userAssignedIdentities must be provided when identity.type is equal to "UserAssigned".

  • 400 MissingIdentityType - Please specify the identity type.

  • 400 MultipleIdentitiesOnJobAgent - Please specify only one user managed identity per job agent.

  • 400 InvalidIdentityType - Please specify only "None" or "UserAssigned" identity types.

  • 400 SkuMismatchingNameCapacity - The SKU capacity provided does not match with provided SKU name.

  • 400 ElasticJobAgentEditionUnsupported - The given SLO is not supported for job agent. Please retry with the supported SLO.

  • 400 ElasticJobAgentObjectiveAssignmentInProgress - The SLO assignment for elastic job agent '{0}' is currently in progress. Please retry operation later.

  • 400 ElasticJobAgentEditionUnsupported - The given SLO is not supported for job agent. Please retry with the supported SLO.

  • 400 DatabaseDoesNotExist - The requested database was not found

  • 400 JobAgentExceededQuota - Could not create job agent because it would exceed the quota.

  • 400 JobAgentAlreadyExists - The job agent already exists on the server.

  • 400 JobAgentDatabaseEditionUnsupported - The specified database's service level objective is not supported for use as a job agent database.

  • 400 JobAgentDatabaseSecondary - A job agent cannot be linked to a geo-secondary database.

  • 400 JobAgentDatabaseAlreadyLinked - The specified database is already linked to another job agent.

  • 400 ElasticJobsNotSupportedOnAutoPauseEnabledDatabase - Auto-pause enabled serverless database is not supported as an Elastic Jobs database because job agent would prevent that database from pausing. You can either disable auto-pause on this serverless database or delete the job agent that is using this database. See here for more details: https://docs.microsoft.com/azure/azure-sql/database/serverless-tier-overview#auto-pausing

  • 400 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

  • 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

  • 404 SubscriptionDoesNotHaveServer - The requested server was not found

  • 404 SubscriptionNotFound - The requested subscription was not found.

  • 404 PropertyChangeUnsupported - Property cannot be modified.

  • 404 OperationIdNotFound - The operation with Id does not exist.

  • 409 ServerDisabled - Server is disabled.

  • 409 ElasticJobAgentOperationUnavailable - The operation '{0}' is blocked for Elastic Job Agent '{1}' because {2}

  • 409 CannotCancelOperation - The management operation is in a state that cannot be cancelled.

  • 409 OperationCancelled - The operation has been cancelled by user.

  • 409 OperationInterrupted - The operation on the resource could not be completed because it was interrupted by another operation on the same resource.

  • 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

  • 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

  • 500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.

  • 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

Examples

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

Sample request

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"
  }
}

Sample response

{
  "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

Sample request

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"
  }
}

Sample response

{
  "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.

Sample request

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"
  }
}

Sample response

{
  "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"
  }
}

Definitions

Name Description
ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

JobAgent

An Azure SQL job agent.

JobAgentIdentity

Azure Active Directory identity configuration for a resource.

JobAgentIdentityType

The job agent identity type

JobAgentState

The state of the job agent.

JobAgentUserAssignedIdentity

Azure Active Directory identity configuration for a resource.

Sku

An ARM Resource SKU.

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response

Name Type Description
error

ErrorDetail

The error object.

JobAgent

An Azure SQL job agent.

Name Type Description
id

string

Resource ID.

identity

JobAgentIdentity

The identity of the job agent.

location

string

Resource location.

name

string

Resource name.

properties.databaseId

string (arm-id)

Resource ID of the database to store job metadata in.

properties.state

JobAgentState

The state of the job agent.

sku

Sku

The name and tier of the SKU.

tags

object

Resource tags.

type

string

Resource type.

JobAgentIdentity

Azure Active Directory identity configuration for a resource.

Name Type Description
tenantId

string (uuid)

The job agent identity tenant id

type

JobAgentIdentityType

The job agent identity type

userAssignedIdentities

<string,  JobAgentUserAssignedIdentity>

The resource ids of the user assigned identities to use

JobAgentIdentityType

The job agent identity type

Value Description
None
SystemAssigned
SystemAssignedUserAssigned
UserAssigned

JobAgentState

The state of the job agent.

Value Description
Creating
Deleting
Disabled
Ready
Updating

JobAgentUserAssignedIdentity

Azure Active Directory identity configuration for a resource.

Name Type Description
clientId

string (uuid)

The Azure Active Directory client id.

principalId

string (uuid)

The Azure Active Directory principal id.

Sku

An ARM Resource SKU.

Name Type Description
capacity

integer (int32)

Capacity of the particular SKU.

family

string

If the service has different generations of hardware, for the same SKU, then that can be captured here.

name

string

The name of the SKU, typically, a letter + Number code, e.g. P3.

size

string

Size of the particular SKU

tier

string

The tier or edition of the particular SKU, e.g. Basic, Premium.