Create a job
The Create a Job operation creates a new job using a provided GUID as its ID, and also starts it.
Request
To specify the request, replace <subscription-id> with your subscription ID, <cloud-service-name> with the name of the cloud service to use for making the request, <automation-account-name> with the name of the automation account to use for making the request, and <job-id> with a GUID for the job. Include required URI parameters.
Tip
To ceate a GUID in Windows PowerShell:
PS C:\> [GUID]::NewGuid().ToString()
Method |
Request URI |
---|---|
PUT |
https://management.core.windows.net/<subscription-id>/cloudServices/<cloud-service-name>/resources/automation/~/automationAccounts/<automation-account-name>/jobs/<job-id>?api-version=2014-12-08 |
URI Parameters
Parameter |
Description |
---|---|
api-version |
Required. Must be set to 2014-12-08. |
Request Headers
The request headers in the following table are required.
Request Header |
Description |
---|---|
Content-Type |
Set to application/json. Do not include a specification for charset. |
x-ms-version |
Specifies the version of the operation. Set to 2013-06-01 or a later version. |
Request Body
{
"properties":{
"runbook":{
"name":"Use-RunbookParameterSample"
},
"parameters":{
"Name":"Scarlett",
"Number":77,
"SayGoodbye":"true"
}
}
}
Element |
Required |
Type |
Description |
---|---|---|---|
Runbook/name |
Yes |
String |
The name of the runbook for the job to start. (Not to be confused with the GUID in the request URI that is the job-ID.) |
parameters |
No |
(per parameter) |
A dictionary of the parameter values to use for the job. These are values for the runbookâs parameters. Keys (parameter names) should be strings. Values for these keys (parameter values) can be any valid JSON value (string, int, Boolean, array, object, etc.). If the runbook requires no parameters, this property is omitted. |
Response
Status Code
A successful operation returns 201 (Created). For information about common error codes, see HTTP/1.1 Status Code Definitions
Response Headers
Request Header |
Description |
---|---|
x-ms-request-id |
A unique identifier for the current operation. |
Response Body
{
"properties":{
"jobId":"67bf1965-43f2-45ab-882d-55a1fc551fcd",
"creationTime":"2015-04-28T20:43:48.32+00:00",
"provisioningState":"Processing",
"status":"New",
"statusDetails":"None",
"startedBy":null,
"startTime":null,
"endTime":null,
"lastModifiedTime":"2015-04-28T20:43:48.32+00:00",
"lastStatusModifiedTime":"2015-04-28T20:43:48.32+00:00",
"exception":null,
"parameters":{
"Name":"Bernique",
"Number":"77",
"SayGoodbye":"true"
},
"runOn":null,
"runbook":{
"name":"Use-RunbookParameterSample"
}
}
}
Element |
Description |
---|---|
JobID |
The GUID that was provided for this job's ID. |
provisioningState |
The state of provisioning the job. This is tantamount to the job execution state until a terminal state is reached. |
status |
The execution status of the job. For status descriptions, see Viewing the Status of a Runbook Job [OaaS]. |
statusDetails |
The job status detail. |
startTime |
The start time of the job. |
endTime |
The end time of the job. |
lastModifiedTime |
The date and time the job was last changed. |
lastStatusModifiedTime |
The date and time the job's status field was changed. |
lastStatusModifiedTime |
The time the status was last modified. |
exception |
The exception message if the job encountered an exception. |
parameters |
The parameters and parameter values of the job. |
See Also
Automation Jobs
Automation Runbooks
Operations on Automation