Get runbook content of a job
The Get runbook content of a job operation returns the runbook content of a job in the raw body of the response after the response headers. You can use this task to keep a record of the content as jobs are run, as runbook contents change.
To see just the rendered output of a job, use the Get output of a job 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 <job-id> with the GUID that was used to create the job. Include required URI parameters.
Method |
Request URI |
---|---|
GET |
https://management.core.windows.net/<subscription-id>/cloudServices/<cloud-service-name>/resources/automation/~/automationAccounts/<automation-account-name>/jobs/<job-id>/runbookContent?api-version=2014-12-08 |
URI Parameters
Parameter |
Description |
---|---|
api-version |
Required. Must be set to 2014-12-08. |
Request Headers
The request header in the following table is required.
Request Header |
Description |
---|---|
x-ms-version |
Specifies the version of the operation. Set to 2013-06-01 or a later version. |
Request Body
None
Response
Status Code
A successful operation returns 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. |
Response Body
The runbook is provided as text after the response headers in the raw body of the response, as shown here for the Use-RunbookParameterSample runbook:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 2007
Content-Type: text/powershell
Expires: -1
Vary: Accept-Encoding
Server: 1.0.6198.202 (rd_rdfe_stable.150307-1902) Microsoft-HTTPAPI/2.0
Strict-Transport-Security: max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET,ASP.NET
x-ms-request-id: 7bc70069075f58e588973767ee3331a0
Date: Wed, 29 Apr 2015 02:05:18 GMT
<#
.SYNOPSIS
Takes different types of input parameters and outputs them.
.DESCRIPTION
This runbook demonstrates how to use input parameters for runbooks.
It also illustrates how to specify whether parameters are required, provide default parameter values,
and use parameter values later in the workflow.
.PARAMETER Name
String name entered to print as output
.PARAMETER Number
Int number to be used to print as output
.PARAMETER StringArray
Array of strings used to loop through and print as output.
An example of valid input is: [1,'astringvalue', 2, 'anotherStringValue']
.PARAMETER Date
DateTime selected by the user used to print as the date entered
.PARAMETER GoodBye
Boolean True/False value used to determine whether or not to print goodbye.
.NOTES
Author: System Center Automation Team
Last Updated: 3/3/2014
#>
workflow Use-RunbookParameterSample
{
# Specify input parameters here
param (
# Optional parameter of type String, default value \"World\"
[parameter(Mandatory=$false)]
[string]$Name = "World",
# Mandatory parameter of type int
[parameter(Mandatory=$true)]
[int]$Number,
# Optional parameter of type string array
# When starting a runbook through the GUI, separate array values with a comma as you would
# in json: [1,'astringvalue']
[parameter(Mandatory=$false)]
[string[]]$StringArray,
# Mandatory parameter of type DateTime
[parameter(Mandatory=$true)]
[DateTime]$Date,
# Mandatory parameter of type boolean
[parameter(Mandatory=$true)]
[boolean]$SayGoodbye
)
# Print output based on input parameter values
"Hello $Name"
"You entered the number $Number"
# Print each item in string array
foreach ($Elem in $StringArray){
$Elem
}
# Print the DateTime value
$Date
# Only print \"Goodbye\" if boolean variable has been set to true
if($SayGoodbye)
{
"Goodbye"
}
}