Skip to main content

job

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

Overview

Namejob
TypeResource
Idazure.automation.job

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.
creationTimestring (date-time)Gets or sets the creation time of the job.
endTimestring (date-time)Gets or sets the end time of the job.
exceptionstringGets or sets the exception of the job.
jobIdstringGets or sets the id of the job.
jobRuntimeEnvironmentobjectRuntime Environment Property.
lastModifiedTimestring (date-time)Gets or sets the last modified time of the job.
lastStatusModifiedTimestring (date-time)Gets or sets the last status modified time of the job.
parametersobjectGets or sets the parameters of the job.
provisioningStatestringThe current provisioning state of the job. Known values are: "Failed", "Succeeded", "Suspended", and "Processing". (Failed, Succeeded, Suspended, Processing)
runOnstringGets or sets the runOn which specifies the group name where the job is to be executed.
runbookobjectGets or sets the runbook.
startTimestring (date-time)Gets or sets the start time of the job.
startedBystringGets or sets the job started by.
statusstringGets or sets the status of the job. Known values are: "New", "Activating", "Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected", "Suspending", "Stopping", "Resuming", and "Removing". (New, Activating, Running, Completed, Failed, Stopped, Blocked, Suspended, Disconnected, Suspending, Stopping, Resuming, Removing)
statusDetailsstringGets or sets the status details of the job.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
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, automation_account_name, job_name, subscription_idclientRequestIdRetrieve the job identified by job name.
list_by_automation_accountselectresource_group_name, automation_account_name, subscription_id$filter, clientRequestIdRetrieve a list of jobs.
createinsertresource_group_name, automation_account_name, job_name, subscription_id, propertiesclientRequestIdCreate a job of the runbook.
get_outputexecresource_group_name, automation_account_name, job_name, subscription_idclientRequestIdRetrieve the job output identified by job name.
get_runbook_contentexecresource_group_name, automation_account_name, job_name, subscription_idclientRequestIdRetrieve the runbook content of the job identified by job name.
suspendexecresource_group_name, automation_account_name, job_name, subscription_idclientRequestIdSuspend the job identified by job name.
stopexecresource_group_name, automation_account_name, job_name, subscription_idclientRequestIdStop the job identified by jobName.
resumeexecresource_group_name, automation_account_name, job_name, subscription_idclientRequestIdResume the job identified by jobName.

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
automation_account_namestringThe name of the automation account. Required.
job_namestringThe job name. Required.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
subscription_idstring
$filterstringThe filter to apply on the operation. Default value is None.
clientRequestIdstringIdentifies this specific client request. Default value is None.

SELECT examples

Retrieve the job identified by job name.

SELECT
id,
name,
creationTime,
endTime,
exception,
jobId,
jobRuntimeEnvironment,
lastModifiedTime,
lastStatusModifiedTime,
parameters,
provisioningState,
runOn,
runbook,
startTime,
startedBy,
status,
statusDetails,
systemData,
type
FROM azure.automation.job
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND automation_account_name = '{{ automation_account_name }}' -- required
AND job_name = '{{ job_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND clientRequestId = '{{ clientRequestId }}'
;

INSERT examples

Create a job of the runbook.

INSERT INTO azure.automation.job (
properties,
resource_group_name,
automation_account_name,
job_name,
subscription_id,
clientRequestId
)
SELECT
'{{ properties }}' /* required */,
'{{ resource_group_name }}',
'{{ automation_account_name }}',
'{{ job_name }}',
'{{ subscription_id }}',
'{{ clientRequestId }}'
RETURNING
id,
name,
properties,
systemData,
type
;

Lifecycle Methods

Retrieve the job output identified by job name.

EXEC azure.automation.job.get_output 
@resource_group_name='{{ resource_group_name }}' --required,
@automation_account_name='{{ automation_account_name }}' --required,
@job_name='{{ job_name }}' --required,
@subscription_id='{{ subscription_id }}' --required,
@clientRequestId='{{ clientRequestId }}'
;