Skip to main content

job_executions

Creates, updates, deletes, gets or lists a job_executions resource.

Overview

Namejob_executions
TypeResource
Idazure.sql.job_executions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
createTimestring (date-time)The time that the job execution was created.
currentAttemptStartTimestring (date-time)Start time of the current attempt.
currentAttemptsintegerNumber of times the job execution has been attempted.
endTimestring (date-time)The time that the job execution completed.
jobExecutionIdstringThe unique identifier of the job execution.
jobVersionintegerThe job version number.
lastMessagestringThe last status or error message.
lifecyclestringThe detailed state of the job execution. Known values are: "Created", "InProgress", "WaitingForChildJobExecutions", "WaitingForRetry", "Succeeded", "SucceededWithSkipped", "Failed", "TimedOut", "Canceled", and "Skipped". (Created, InProgress, WaitingForChildJobExecutions, WaitingForRetry, Succeeded, SucceededWithSkipped, Failed, TimedOut, Canceled, Skipped)
provisioningStatestringThe ARM provisioning state of the job execution. Known values are: "Created", "InProgress", "Succeeded", "Failed", and "Canceled". (Created, InProgress, Succeeded, Failed, Canceled)
startTimestring (date-time)The time that the job execution started.
stepIdintegerThe job step id.
stepNamestringThe job step name.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
targetobjectThe target that this execution is executed on.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, server_name, job_agent_name, job_name, job_execution_id, subscription_idGets a job execution.
list_by_jobselectresource_group_name, server_name, job_agent_name, job_name, subscription_idcreateTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, $skip, $topLists a job's executions.
list_by_agentselectresource_group_name, server_name, job_agent_name, subscription_idcreateTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, $skip, $topLists all executions in a job agent.
create_or_updateinsertresource_group_name, server_name, job_agent_name, job_name, job_execution_id, subscription_idCreates or updates a job execution.
createinsertresource_group_name, server_name, job_agent_name, job_name, subscription_idStarts an elastic job execution.
create_or_updatereplaceresource_group_name, server_name, job_agent_name, job_name, job_execution_id, subscription_idCreates or updates a job execution.
cancelexecresource_group_name, server_name, job_agent_name, job_name, job_execution_id, subscription_idRequests cancellation of a job execution.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
job_agent_namestringThe name of the job agent. Required.
job_execution_idstringThe id of the job execution. Required.
job_namestringThe name of the job. Required.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
server_namestringThe name of the server. Required.
subscription_idstring
$skipintegerThe number of elements in the collection to skip. Default value is None.
$topintegerThe number of elements to return from the collection. Default value is None.
createTimeMaxstring (date-time)If specified, only job executions created before the specified time are included. Default value is None.
createTimeMinstring (date-time)If specified, only job executions created at or after the specified time are included. Default value is None.
endTimeMaxstring (date-time)If specified, only job executions completed before the specified time are included. Default value is None.
endTimeMinstring (date-time)If specified, only job executions completed at or after the specified time are included. Default value is None.
isActivebooleanIf specified, only active or only completed job executions are included. Default value is None.

SELECT examples

Gets a job execution.

SELECT
id,
name,
createTime,
currentAttemptStartTime,
currentAttempts,
endTime,
jobExecutionId,
jobVersion,
lastMessage,
lifecycle,
provisioningState,
startTime,
stepId,
stepName,
systemData,
target,
type
FROM azure.sql.job_executions
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND server_name = '{{ server_name }}' -- required
AND job_agent_name = '{{ job_agent_name }}' -- required
AND job_name = '{{ job_name }}' -- required
AND job_execution_id = '{{ job_execution_id }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Creates or updates a job execution.

INSERT INTO azure.sql.job_executions (
resource_group_name,
server_name,
job_agent_name,
job_name,
job_execution_id,
subscription_id
)
SELECT
'{{ resource_group_name }}',
'{{ server_name }}',
'{{ job_agent_name }}',
'{{ job_name }}',
'{{ job_execution_id }}',
'{{ subscription_id }}'
RETURNING
id,
name,
properties,
systemData,
type
;

REPLACE examples

Creates or updates a job execution.

REPLACE azure.sql.job_executions
SET
-- No updatable properties
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND server_name = '{{ server_name }}' --required
AND job_agent_name = '{{ job_agent_name }}' --required
AND job_name = '{{ job_name }}' --required
AND job_execution_id = '{{ job_execution_id }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
properties,
systemData,
type;

Lifecycle Methods

Requests cancellation of a job execution.

EXEC azure.sql.job_executions.cancel 
@resource_group_name='{{ resource_group_name }}' --required,
@server_name='{{ server_name }}' --required,
@job_agent_name='{{ job_agent_name }}' --required,
@job_name='{{ job_name }}' --required,
@job_execution_id='{{ job_execution_id }}' --required,
@subscription_id='{{ subscription_id }}' --required
;