Pre-Requisites
The Automation account page gives you a quick view of the resources in this account. You should already have some assets. Most of those are the modules that are automatically included in a new Automation account. You should also have the Credential asset that's mentioned in the prerequisites.
You can either type code directly into the runbook, or you can select cmdlets, runbooks, and assets from the Library control and have them added to the runbook with any related parameters. For this walkthrough, you type directly in the runbook.
In our case, for the POC this document was generated by, the script was as following:
Invoke-ASCmd –InputFile small.json -Server "asazure://westus.asazure.windows.net/trdlpocaas"
Invoke-ASCmd –InputFile medium.json -Server "asazure://westus.asazure.windows.net/trdlpocaas"
Invoke-ASCmd –InputFile reports.json -Server "asazure://westus.asazure.windows.net/trdlpocaas"
Invoke-ASCmd –InputFile big.json -Server "asazure://westus.asazure.windows.net/trdlpocaas"
Before you publish the runbook to make it available in production, you want to test it to make sure that it works properly. When you test a runbook, you run its Draft version and view its output interactively.
The job status starts as Queued indicating that it is waiting for a runbook worker in the cloud to come available. It moves to Starting when a worker claims the job, and then Running when the runbook actually starts running.
5. Close the Test pane to return to the canvas.
The runbook that you created is still in Draft mode. you need to publish it before you can run it in production. When you publish a runbook, you overwrite the existing Published version with the Draft version. In your case, you don't have a Published version yet because you just created the runbook.
You've tested and published your runbook, but so far it doesn't do anything useful. You want to have it manage Azure resources. It is not able to do that though unless You have it authenticate using the credentials that are referred to in the prerequisites. You do that with the Add-AzureRmAccount cmdlet.
$Conn = Get-AutomationConnection -Name AzureRunAsConnection
Add-AzureRMAccount -ServicePrincipal -Tenant $Conn.TenantID `
-ApplicationId $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint