Share via


Create a schedule

 

The Create a schedule operation creates a schedule for a job to run, but it cannot run until it is linked to a runbook by using the Associate a schedule with a runbook operation.

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 <schedule-name> with a name for the schedule. 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>/schedules/<schedule-name>?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

This request creates a schedule to start at 9AM UTC on May 5, 2015 and ends on the same day and time a year later. It will run every 2 hours.

{
   "properties":{
      "description":"Run every other hour",
      "startTime":"2015-05-11T09:00:00",
      "expiryTime":"2016-05-22T09:00:00",
      "isEnabled":true,
      "interval":2,
      "frequency":"hour"
   }
}

Element

Required

Type

Description

description

No

String

The description of the schedule.

startTime

Yes

DateTime

The starting time of the schedule in UTC.

expiryTime

No

DateTime

The ending time of the schedule (the time after which it no longer executes).

isEnabled

No

Boolean

Use this property when you want to disable schedules when they are not needed, but not delete them.

interval

No

Integer

The periodic interval that the schedule activates

frequency

Yes

Integer

Indicate how frequent should the schedule run. Supported values are: onetime, hour, day

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

{
   "name":"AuditSched",
   "properties":{
      "description":"Run every other hour",
      "startTime":"2015-05-11T09:00:00+00:00",
      "expiryTime":"2016-05-22T09:00:00+00:00",
      "isEnabled":true,
      "nextRun":"2015-05-11T09:00:00+00:00",
      "interval":2,
      "frequency":"Hour",
      "creationTime":"2015-05-03T21:28:21.02+00:00",
      "lastModifiedTime":"2015-05-03T21:28:21.02+00:00"
   }
}

Element

Description

name

The name of the schedule

description

The description of the schedule.

startTime

The starting time of the schedule.

expiryTime

The ending time of the schedule (the time after which it no longer executes).

isEnabled

The flag indicating whether the schedule is enabled. Default is true.

nextRun

The next time the schedule will activate.

interval

The periodic interval that the schedule activates.

frequency

Indicates the frequency the schedule will run.

creationTime

The date and time the schedule was created.

lastModifiedTime

The date and time the schedule was last changed.

See Also

Automation Schedules
Operations on Automation