Using Azure Automation: Part 4


Summary: Learn how to report output from Azure Automation and publish to production.

Honorary Scripting Guy, Sean Kearney, is here again to show you more about Azure Automation and to empower you in automating your assets in Azure. This is the fourth post in a five-part series. To catch up, read:

Our current task is trying to see what is happening in the magic genie bottle that contains our Azure Automation runbook. I say "magic genie bottle" because up to this point, we really can't see what's going on, can we? There's no Windows Powershell console, no ISE.

Nothing…

Not a sausage!

Well actually, that's not true. I fibbed a bit. We do have an output pane that is waiting for output. When you run Test on the runbook, you'll see a window at the bottom of the webpage that shows nothing other than Status StartingBut we can have some output go to this window. It's actually pretty easy. Simply use the Write-Output cmdlet with some information.

Image of menu

We can add some status reports to our workflow now by injected in some appropriate Write-Output statements.

Image of script

Now the runbook will send status messages to the output pane, as you can see here:

We now have confirmation that it's running properly!

At this point, we take the next big step: promoting to production and making it a real runbook (yes, Pinocchio, it's your time). This is done by clicking the Publish button after you click Save:

Image of menu

You will be prompted for confirmations to continue each time. When done, you'll get a happy status message like this one:

Image of message

You'll also notice that your runbook lettering is greyed out because it's now a production runbook. If you click Draft again, you'll notice a new option to edit the existing production runbook. Go ahead!

Image of message

When you click Edit, you'll see a copy of your production runbook. Take note of the operative word "copy." If you make changes, you are not editing the main runbook. Nothing will change in the main runbook until you save and publish again. As shown here, you'll see a Discard Draft button now, which allows you to scrap the current draft:

Image of script

Now that we have a functional runbook, the next step is running it.

That we will. Tomorrow...

Tomorrow, young scripter. We'll end the week on a solid note with Windows PowerShell!

I invite you to follow The Scripting Guys on Twitter and Facebook. If you have any questions, send an email to The Scripting Guys at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then remember eat your cmdlets every day with a taste of creativity.

Sean Kearney, Windows PowerShell MVP and Honorary Scripting Guy 

Comments (0)

Skip to main content