Associate a schedule with a runbook

 

The Associate a schedule with a runbook operation configures a runbook to run according to a specified schedule. A job schedule is an association between a runbook and a schedule.

To link a schedule with a runbook, you will need to generate a GUID for the job-schedule-ID. For example, to do this in Windows PowerShell:

$jobID = [GUID]::NewGuid().ToString()

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 generated GUID value for the <job-schedule-id>. Include required URI parameters.

Method

Request URI

PUT

https://management.core.windows.net/<subscription-id>/cloudServices/<cloud-service-name>/resources/automation/~/automationAccounts/<automation-account-name>/jobSchedules/<job-schedule-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":{
      "schedule":{
         "Name":"Sched10"
      },
      "runbook":{
         "name":"Use-RunbookParameterSample"
      },
      "parameters":{
         "Date":"4/29/2015",
         "Number":55,
         "Name":"Scarlett",
         "SayGoodbye":"true"
      }
   }
}

Element

Required

Type

Description

Schedule/name

Yes

String

The name of the schedule (not to be confused with the job scheduled ID).

runbook/name

Yes

String

The name of the runbook to link with the schedule.

parameters

No

String

As applicable, an array of job parameter names and values to be passed to the runbook when the schedule starts a new job for the runbook.

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":{
      "jobScheduleId":"ade81e06-1e93-4c37-84b7-4e40e9694641",
      "runbook":{
         "name":"Use-RunbookParameterSample"
      },
      "schedule":{
         "name":"Sched10"
      },
      "parameters":{
         "Date":"4\/29\/2015",
         "Number":"55",
         "Name":"Scarlett",
         "SayGoodbye":"true"
      }
   }
}

Element

Description

jobScheduleID

The GUID that was provided for the job schedule ID.

runbook/Name

The name of the runbook linked to the schedule.

schedule/Name

The name of the linked schedule.

parameters

As applicable, an array of job parameter names and values to be passed to the runbook when the schedule starts a new job for the runbook

See Also

Automation Schedules
Operations on Automation