Runbook Draft - Get Content

Retrieve the content of runbook draft identified by runbook name.


URI Parameters

Name In Required Type Description
path True
  • string

Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

path True
  • string

Name of an Azure Resource group.

Regex pattern: ^[-\w\._]+$

path True
  • string

The name of the automation account.

path True
  • string

The runbook name.

query True
  • string

Client Api Version.


Name Type Description
200 OK
  • file


Media Types: "text/powershell"

Other Status Codes

Automation error response describing why the operation failed.

Media Types: "text/powershell"


Get runbook draft content

Sample Request


Sample Response

Content-Type: text/powershell
"<#\r\n .description\r\n="" an="" example="" runbook="" which="" prints="" out="" the="" first10="" azure="" vms="" in="" your="" subscription="" (ordered="" alphabetically).\r\n="" for="" more="" information="" about="" how="" this="" runbook="" authenticates="" to="" your="" azure="" subscription,="" see="" our="" documentation="" here:="" http:=""\r\n\r\n="" .notes\r\n="" author:="" azure="" automation="" team\r\n="" lastedit:="" mar27,\r\n="" 2015\r\n#="">\r\nworkflow Get-AzureVMTutorial{\r\n    #The name of the Automation Credential Asset this runbook will use to authenticate to Azure.\r\n    $CredentialAssetName = 'DefaultAzureCredential'\r\n\r\n    #Get the credential with the above name from the Automation Asset store\r\n    $Cred = Get-AutomationPSCredential -Name $CredentialAssetName\r\n    if(!$Cred){\r\n        Throw\"Could not find an Automation Credential Asset named '${CredentialAssetName}'. Make sure you have created one in this Automation Account.\"\r\n                }\r\n\r\n    #Connect to your Azure Account\r\n    $Account = Add-AzureAccount -Credential $Cred\r\n    if(!$Account){\r\n        Throw\"Could not authenticate to Azure using the credential asset '${CredentialAssetName}'. Make sure the user name and password are correct.\"\r\n                }\r\n\r\n    #TODO (optional): pick the right subscription to use. Without this line, the default subscription for your Azure Account will be used.\r\n    #Select-AzureSubscription -SubscriptionName\"TODO: your Azure subscription name here\"\r\n    \r\n    #Get all the VMs you have in your Azure subscription\r\n    $VMs = Get-AzureVM\r\n\r\n    #Print out up to10 of those VMs\r\n    if(!$VMs){\r\n        Write-Output\"No VMs were found in your subscription.\"\r\n                } else{\r\n        Write-Output $VMs[0..9\r\n                    ]\r\n                }\r\n            }"



Error response of an operation failure

Name Type Description
  • string

Error code

  • string

Error message indicating why the operation failed.