Job Steps - Create Or Update

Creates or updates a job step. This will implicitly create a new job version.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}?api-version=2025-01-01

URI Parameters

Name In Required Type Description
jobAgentName
path True

string

The name of the job agent.

jobName
path True

string

The name of the job.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

serverName
path True

string

The name of the server.

stepName
path True

string

The name of the job step.

subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Required Type Description
properties.action True

JobStepAction

The action payload of the job step.

properties.targetGroup True

string

The resource ID of the target group that the job step will be executed on.

properties.credential

string

The resource ID of the job credential that will be used to connect to the targets.

properties.executionOptions

JobStepExecutionOptions

Execution options for the job step.

properties.output

JobStepOutput

Output destination properties of the job step.

properties.stepId

integer (int32)

The job step's index within the job. If not specified when creating the job step, it will be created as the last step. If not specified when updating the job step, the step id is not modified.

Responses

Name Type Description
200 OK

JobStep

Resource 'JobStep' update operation succeeded

201 Created

JobStep

Resource 'JobStep' create operation succeeded

Other Status Codes

ErrorResponse

An unexpected error response.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Create or update a job step with all properties specified.
Create or update a job step with minimal properties specified.

Create or update a job step with all properties specified.

Sample request

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

{
  "properties": {
    "action": {
      "type": "TSql",
      "source": "Inline",
      "value": "select 2"
    },
    "credential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1",
    "executionOptions": {
      "initialRetryIntervalSeconds": 11,
      "maximumRetryIntervalSeconds": 222,
      "retryAttempts": 42,
      "retryIntervalBackoffMultiplier": 3,
      "timeoutSeconds": 1234
    },
    "output": {
      "type": "SqlDatabase",
      "credential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0",
      "databaseName": "database3",
      "resourceGroupName": "group3",
      "schemaName": "myschema1234",
      "serverName": "server3",
      "subscriptionId": "3501b905-a848-4b5d-96e8-b253f62d735a",
      "tableName": "mytable5678"
    },
    "stepId": 1,
    "targetGroup": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"
  }
}

Sample response

{
  "name": "step1",
  "type": "Microsoft.Sql/servers/jobAgents/jobs/steps",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/steps/step1",
  "properties": {
    "action": {
      "type": "TSql",
      "source": "Inline",
      "value": "select 2"
    },
    "credential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1",
    "executionOptions": {
      "initialRetryIntervalSeconds": 11,
      "maximumRetryIntervalSeconds": 222,
      "retryAttempts": 42,
      "retryIntervalBackoffMultiplier": 3,
      "timeoutSeconds": 1234
    },
    "output": {
      "type": "SqlDatabase",
      "credential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0",
      "databaseName": "database3",
      "resourceGroupName": "group3",
      "schemaName": "myschema1234",
      "serverName": "server3",
      "subscriptionId": "3501b905-a848-4b5d-96e8-b253f62d735a",
      "tableName": "mytable5678"
    },
    "stepId": 1,
    "targetGroup": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"
  }
}
{
  "name": "step1",
  "type": "Microsoft.Sql/servers/jobAgents/jobs/steps",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/steps/step1",
  "properties": {
    "action": {
      "type": "TSql",
      "source": "Inline",
      "value": "select 2"
    },
    "credential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1",
    "executionOptions": {
      "initialRetryIntervalSeconds": 11,
      "maximumRetryIntervalSeconds": 222,
      "retryAttempts": 42,
      "retryIntervalBackoffMultiplier": 3,
      "timeoutSeconds": 1234
    },
    "output": {
      "type": "SqlDatabase",
      "credential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0",
      "databaseName": "database3",
      "resourceGroupName": "group3",
      "schemaName": "myschema1234",
      "serverName": "server3",
      "subscriptionId": "3501b905-a848-4b5d-96e8-b253f62d735a",
      "tableName": "mytable5678"
    },
    "stepId": 1,
    "targetGroup": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"
  }
}

Create or update a job step with minimal properties specified.

Sample request

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

{
  "properties": {
    "action": {
      "value": "select 1"
    },
    "targetGroup": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup0"
  }
}

Sample response

{
  "name": "step1",
  "type": "Microsoft.Sql/servers/jobAgents/jobs/steps",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/steps/step1",
  "properties": {
    "action": {
      "type": "TSql",
      "source": "Inline",
      "value": "select 1"
    },
    "executionOptions": {
      "initialRetryIntervalSeconds": 1,
      "maximumRetryIntervalSeconds": 120,
      "retryAttempts": 10,
      "retryIntervalBackoffMultiplier": 2,
      "timeoutSeconds": 43200
    },
    "stepId": 1,
    "targetGroup": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup0"
  }
}
{
  "name": "step1",
  "type": "Microsoft.Sql/servers/jobAgents/jobs/steps",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/steps/step1",
  "properties": {
    "action": {
      "type": "TSql",
      "source": "Inline",
      "value": "select 1"
    },
    "credential": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0",
    "executionOptions": {
      "initialRetryIntervalSeconds": 1,
      "maximumRetryIntervalSeconds": 120,
      "retryAttempts": 10,
      "retryIntervalBackoffMultiplier": 2,
      "timeoutSeconds": 43200
    },
    "stepId": 1,
    "targetGroup": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup0"
  }
}

Definitions

Name Description
createdByType

The type of identity that created the resource.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

JobStep

A job step.

JobStepAction

The action to be executed by a job step.

JobStepActionSource

The source of the action to execute.

JobStepActionType

Type of action being executed by the job step.

JobStepExecutionOptions

The execution options of a job step.

JobStepOutput

The output configuration of a job step.

JobStepOutputType

The output destination type.

systemData

Metadata pertaining to creation and last modification of the resource.

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

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.

JobStep

A job step.

Name Type Description
id

string (arm-id)

Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"

name

string

The name of the resource

properties.action

JobStepAction

The action payload of the job step.

properties.credential

string

The resource ID of the job credential that will be used to connect to the targets.

properties.executionOptions

JobStepExecutionOptions

Execution options for the job step.

properties.output

JobStepOutput

Output destination properties of the job step.

properties.stepId

integer (int32)

The job step's index within the job. If not specified when creating the job step, it will be created as the last step. If not specified when updating the job step, the step id is not modified.

properties.targetGroup

string

The resource ID of the target group that the job step will be executed on.

systemData

systemData

Azure Resource Manager metadata containing createdBy and modifiedBy information.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

JobStepAction

The action to be executed by a job step.

Name Type Default value Description
source

JobStepActionSource

Inline

The source of the action to execute.

type

JobStepActionType

TSql

Type of action being executed by the job step.

value

string

The action value, for example the text of the T-SQL script to execute.

JobStepActionSource

The source of the action to execute.

Value Description
Inline

Inline

JobStepActionType

Type of action being executed by the job step.

Value Description
TSql

TSql

JobStepExecutionOptions

The execution options of a job step.

Name Type Default value Description
initialRetryIntervalSeconds

integer (int32)

1

Initial delay between retries for job step execution.

maximumRetryIntervalSeconds

integer (int32)

120

The maximum amount of time to wait between retries for job step execution.

retryAttempts

integer (int32)

10

Maximum number of times the job step will be reattempted if the first attempt fails.

retryIntervalBackoffMultiplier

number (float)

2

The backoff multiplier for the time between retries.

timeoutSeconds

integer (int32)

43200

Execution timeout for the job step.

JobStepOutput

The output configuration of a job step.

Name Type Default value Description
credential

string

The resource ID of the credential to use to connect to the output destination.

databaseName

string

The output destination database.

resourceGroupName

string

The output destination resource group.

schemaName

string

dbo

The output destination schema.

serverName

string

The output destination server name.

subscriptionId

string (uuid)

The output destination subscription id.

tableName

string

The output destination table.

type

JobStepOutputType

SqlDatabase

The output destination type.

JobStepOutputType

The output destination type.

Value Description
SqlDatabase

SqlDatabase

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string (date-time)

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string (date-time)

The timestamp of resource last modification (UTC)

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.