Update the draft content of a runbook

 

The Update the draft content of a runbook operation updates the draft content of an existing runbook that is in draft, or edit, mode.

For this operation, the request content type must be text/powershell.

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 (that is in draft mode) to update. 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/content?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 text/powershell.

x-ms-version

Specifies the version of the operation. Set to 2013-06-01 or a later version.

Request Body

In the following example, the entire runbook for an edited version of the Write-HelloWorld runbook is provided in the request body. The only change is the default name of "World" is changed to "Azure", which is also reflected in the comments.

<#
.SYNOPSIS
    Provides a simple example of a Azure Automation runbook.  
.DESCRIPTION
    This runbook provides the "Hello Azure" example for Azure Automation.  If you are 
    brand new to Automation in Azure, you can use this runbook to explore testing 
    and publishing capabilities.  

    The runbook takes in an optional string parameter.  If you leave the parameter blank, the 
    default of $Name will equal "Azure".  The runbook then prints "Azure" concatenated with $Name.
.PARAMETER Name
    String value to print as output
.EXAMPLE
    Write-HelloWorld -Name "World"
.NOTES
Author: System Center Automation Team
Modified: Documentation example change
Last Updated: 5/5/2015   
#>

workflow Write-HelloWorld {
    param (

        # Optional parameter of type string. 
        # If you do not enter anything, the default value of Name 
        # will be Azure
        [parameter(Mandatory=$false)]
        [String]$Name = "Azure"
    )

        Write-Output "Hello $Name"

}

Response

Status Code

The operation returns 202 (Accepted) for an asynchronous operation. To determine its current status, issue a GET request to the URL in the Location header contained in the response. Repeat as needed with the URL from each subsequent response until the status code is 200 (OK). 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. Use this value to determine the current status of an asynchronous operation.

Response Body

None

See Also

Automation Runbooks
Operations on Automation