Create a runbook as a draft
The Create a runbook as a draft operation creates a new runbook with the authoring status as new, but not published. This operation differs from the Create a published runbook operation only in the request body.
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 <runbook-name> with the name of the runbook to create. 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>/runbooks/<runbook-name>/draft?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
{
"tags":{
"Testing":"show value",
"Source":"TechNet Script Center"
},
"properties":{
"description":"Hello world",
"runbookType":"Script",
"logProgress":false,
"logVerbose":false,
"draft":{
"draftContentLink":{
"uri":"https://gallery.technet.microsoft.com/scriptcenter/The-Hello-World-of-Windows-81b69574/file/111354/1/Write-HelloWorld.ps1",
"contentVersion":"1.0.0.0",
"contentHash":{
"algorithm":"sha256",
"value":"EqdfsYoVzERQZ3l69N55y1RcYDwkib2+2X+aGUSdr4Q="
}
}
}
}
}
Element |
Required |
Type |
Description |
---|---|---|---|
tags |
No |
String |
A list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 10 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. |
properties/description |
No |
String |
A description for the runbook. |
properties/runbookType |
No |
String |
Script is the only supported runbook type. |
properties/logProgress |
No |
Boolean |
Indicates whether to log progress of the runbook. The default is false. |
properties/logVerbose |
No |
Boolean |
Indicates whether log verbose details of the runbook. The default is false. |
properties/publishContentLink/uri |
Yes |
String |
Specifies the public location of an existing .ps1 file containing a single Windows PowerShell Workflow, to be added to Azure Automation. After successful completion of this request, the runbook content will be published and regular jobs can be started. This location can be any public URL. If using Azure Storage, make sure the blob is public, or use a SAS link to the Azure Storage blob. |
properties/publishContentLink/contentVersion |
No |
String |
Specifies a value for versioning purposes. |
properties/publishContentLink/contentHash/algorithm |
String |
The encryption algorithm used to create the hash. |
|
properties/publishContentLink/contentHash/value |
No |
String |
Specifies the value of the hash of the content at the content link, and the algorithm for obtaining a content hash value as a Base64-encoded string. You can use this to prevent import of the runbook if the content at the content link location is modified after the hash value to use was generated. You can use the following Windows PowerShell script to obtain this value:
|
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
{
"id":"\/subscriptions\/2310a662-9154-4254-a8e1-34286f3bf56a\/cloudservices\/CLSV2_Litware\/resources\/~\/automationAccounts\/LitwareDataCenter\/runbooks\/Write-HelloWorld",
"name":"Write-HelloWorld",
"type":"Microsoft.Automation\/AutomationAccount\/Runbook",
"location":"East US 2",
"tags":{
"Testing":"show value",
"Source":"TechNet Script Center"
},
"etag":"\"635656239424570000\"",
"properties":{
"description":"Hello world",
"logVerbose":false,
"logProgress":false,
"runbookType":"Script",
"parameters":{
},
"state":"New",
"jobCount":0,
"provisioningState":"Succeeded",
"serviceManagementTags":null,
"creationTime":"2015-04-26T05:45:42.457+00:00",
"lastModifiedBy":null,
"lastModifiedTime":"2015-04-26T05:45:42.457+00:00"
}
}
Element |
Description |
---|---|
id |
The URI for this entity, excluding hostname/schema and api version. Not URL encoded. This field is used by the platform as the identifier for references for other objects. |
name |
The name of the runbook. |
type |
The type of the resource (e.g., Microsoft.Automation/AutomationAccount/Runbook) |
location |
Geographical location of resource |
tags |
A list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 10 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. |
etag |
Value used for concurrence control. |
properties/description |
The description provided for the runbook. |
properties/logVerbose |
Indicates whether to log verbose details of the runbook. The default is false. |
properties/logProgress |
Indicates whether to log progress of the runbook. The default is false). |
properties/runbookType |
"Script" is the only supported type. |
properties/parameters |
A list of parameter objects that represent the Runbook parameters. Parameters are extracted as part of the create Runbook process. Parameters objects have a name and the following properties.
|
state |
The status of the runbook. The possible values are: new, edit, published. |
properties/jobCount |
The number of jobs executed. |
properties/provisioningState |
The state of the runbook. Values are succeeded, failed, or cancelled. |
properties/serviceManagementTags |
Freeform values available to the runbook. |
properties/creationTime |
The date and time the runbook was created. |
properties/lastModifiedTime |
The datea and time time the runbook was last modified. |
properties/lastModifiedBy |
The username of the person who last edited the runbook. |