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
pattern: ^[-\w\._]+$

Name of an Azure Resource group.

subscriptionId
path True

string

Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

api-version
query True

string

Client Api Version.

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

Created

Other Status Codes

ErrorResponse

Automation error response describing why the operation failed.

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": {
    "runbook": {
      "name": "TestRunbook"
    },
    "parameters": {
      "key01": "value01",
      "key02": "value02"
    },
    "runOn": ""
  }
}

Sample response

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

Definitions

Name Description
createdByType

The type of identity that created the resource.

ErrorResponse

Error response of an operation failure

Job

Definition of the job.

JobCreateParameters

The parameters supplied to the create job operation.

JobProvisioningState

The current provisioning state of the job.

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

ErrorResponse

Error response of an operation failure

Name Type Description
code

string

Error code

message

string

Error message indicating why the operation failed.

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 current provisioning state of the job.

Value Description
Failed
Succeeded
Suspended
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
Activating
Running
Completed
Failed
Stopped
Blocked
Suspended
Disconnected
Suspending
Stopping
Resuming
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.