Share via


Job - Create

Create a job of the runbook.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}?api-version=2024-10-23

URI Parameters

Name In Required Type Description
automationAccountName
path True

string

The name of the automation account.

jobName
path True

string

The job name.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

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

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 Header

Name Required Type Description
clientRequestId

string

Identifies this specific client request.

Request Body

Name Type Description
properties.parameters

object

Gets or sets the parameters of the job.

properties.runOn

string

Gets or sets the runOn which specifies the group name where the job is to be executed.

properties.runbook

RunbookAssociationProperty

Gets or sets the runbook.

Responses

Name Type Description
201 Created

Job

Resource 'Job' 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 job

Sample request

PUT https://management.azure.com/subscriptions/51766542-3ed7-4a72-a187-0c8ab644ddab/resourceGroups/mygroup/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/jobs/foo?api-version=2024-10-23

{
  "properties": {
    "parameters": {
      "key01": "value01",
      "key02": "value02"
    },
    "runOn": "",
    "runbook": {
      "name": "TestRunbook"
    }
  }
}

Sample response

{
  "name": "foo",
  "type": "Microsoft.Automation/AutomationAccounts/Jobs",
  "id": "/subscriptions/51766542-3ed7-4a72-a187-0c8ab644ddab/resourceGroups/mygroup/providers/Microsoft.Automation/automationAccounts/ContoseAutomationAccount/jobs/jobName",
  "properties": {
    "creationTime": "2018-02-01T05:53:30.243+00:00",
    "endTime": null,
    "exception": null,
    "jobId": "5b8a3960-e8ab-45f6-bec6-567df8467d1a",
    "jobRuntimeEnvironment": {
      "runtimeEnvironmentName": "environmentName"
    },
    "lastModifiedTime": "2018-02-01T05:53:30.243+00:00",
    "lastStatusModifiedTime": "2018-02-01T05:53:30.243+00:00",
    "parameters": {
      "tag01": "value01",
      "tag02": "value02"
    },
    "provisioningState": "Processing",
    "runOn": "",
    "runbook": {
      "name": "TestRunbook"
    },
    "startTime": null,
    "status": "New",
    "statusDetails": "None"
  }
}

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

Job

Definition of the job.

JobCreateParameters

The parameters supplied to the create job operation.

JobProvisioningState

The provisioning state of the resource.

JobRuntimeEnvironment

The runbook property associated with the entity.

JobStatus

Gets or sets the status of the job.

RunbookAssociationProperty

The runbook property associated with the entity.

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.

Job

Definition of the job.

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.creationTime

string (date-time)

Gets or sets the creation time of the job.

properties.endTime

string (date-time)

Gets or sets the end time of the job.

properties.exception

string

Gets or sets the exception of the job.

properties.jobId

string (uuid)

Gets or sets the id of the job.

properties.jobRuntimeEnvironment

JobRuntimeEnvironment

Runtime Environment Property

properties.lastModifiedTime

string (date-time)

Gets or sets the last modified time of the job.

properties.lastStatusModifiedTime

string (date-time)

Gets or sets the last status modified time of the job.

properties.parameters

object

Gets or sets the parameters of the job.

properties.provisioningState

JobProvisioningState

The current provisioning state of the job.

properties.runOn

string

Gets or sets the runOn which specifies the group name where the job is to be executed.

properties.runbook

RunbookAssociationProperty

Gets or sets the runbook.

properties.startTime

string (date-time)

Gets or sets the start time of the job.

properties.startedBy

string

Gets or sets the job started by.

properties.status

JobStatus

Gets or sets the status of the job.

properties.statusDetails

string

Gets or sets the status details of the job.

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"

JobCreateParameters

The parameters supplied to the create job operation.

Name Type Description
properties.parameters

object

Gets or sets the parameters of the job.

properties.runOn

string

Gets or sets the runOn which specifies the group name where the job is to be executed.

properties.runbook

RunbookAssociationProperty

Gets or sets the runbook.

JobProvisioningState

The provisioning state of the resource.

Value Description
Failed

Failed

Succeeded

Succeeded

Suspended

Suspended

Processing

Processing

JobRuntimeEnvironment

The runbook property associated with the entity.

Name Type Description
runtimeEnvironmentName

string

Name of Runtime Environment.

JobStatus

Gets or sets the status of the job.

Value Description
New

New

Activating

Activating

Running

Running

Completed

Completed

Failed

Failed

Stopped

Stopped

Blocked

Blocked

Suspended

Suspended

Disconnected

Disconnected

Suspending

Suspending

Stopping

Stopping

Resuming

Resuming

Removing

Removing

RunbookAssociationProperty

The runbook property associated with the entity.

Name Type Description
name

string

Gets or sets the name of the runbook.

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.