Skip main navigation

Authoring and Editing Graphical Runbooks

.
17.1
Welcome back to graphical rubbooks. This is the last video for this module, so kudos. This is the last but one of the most important ones because not every IT administrator is well-versed with PowerShell, and they just may be getting started with PowerShell sharing but still want to use Azure Automation. Well, this is absolutely for you, then, because what it allows you to do is use the graphical user interface to assemble runbooks. As at your own pace you learn PowerShell, this helps you understand the functioning of Azure Automation as well as runbooks.
50.8
And hopefully as you start using this, you get more familiar with the integrated PowerShell development environment and over time migrate out from graphical runbooks to the really core-base PowerShell runbooks. So what we’ll do is we’ll jump into a demo in this video and look at graphical runbooks. We’ll just, rather than creating one from scratch, import an existing graphical runbook from the open source gallery. And then we’ll start editing that runbook to look at how, if you were authoring this from scratch, you can add more steps or amend the existing steps that are already in there. With that, let’s dive into the demo. All right, so I’m within the scope of Azure portal now.
98.6
As you can see, I’m back into the Runbooks page. Rather than click Add a Runbook, I’m going to click Browse Gallery. And within the gallery, I have the option to search and philtre the search results. So what I’m going to do is I’m going to uncheck the PowerShell and PowerShell workflow and just simply keep the graphical runbook criteria for search. Click OK, and now let’s search for a graphical runbook. ServiceNow is quite a popular tool for process management within organisations. And you know, I’ve heard a lot of administrators asking if there is a process to publish event outputs from Azure into ServiceNow or vise versa.
139.8
So let’s use an existing runbook, open source runbook, that’s already out there that kind of does the same thing. So I’m going to click on the runbook to see what it does. And as you can see, you have a preview pane here where you can Zoom in and see the steps as well. Click and Import just simply gives you an option to call the runbook or amend the existing name that’s given to it and click OK to import it into your Azure automation account. Usually takes a few seconds to complete. Now the runbook has been imported into my Azure subscription within my Automation account. If I click Edit, I can start to make alterations to this runbook.
182.5
Now as you can see here, there is already a process set up which gets information from an external or an Azure resource. And the Azure resource through Webhook is publishing some data. And then we’re simply doing an insert on a SQL, creating a new record in ServiceNow, and then that record starts to show up in ServiceNow. So how would you amend this if you wanted to? Well, for starters, you could go into commandlets and search for a commandlet. Now the obvious thing when I’m trying to edit a runbook that’s already there is to get some more data when it gets executed. So what I want to do is search for something called log, right, or maybe Verbose.
228
So if I search for this, I can see the relevant PowerShell commandlet that is related to it. Let me click this commandlet and say Add to Canvas. So I see a write Verbose commandlet. I didn’t have to type it out, didn’t have to know what it does. Just could search for it right away. And then what I’m going to do is I’m going to link this up to an existing step. So I’m going to say, you know, when the process webhook gets created, I want you to pipe the output of that as a log as well. So what that means is once you get those webhook input parameters that you log them out into the console as well.
272.9
Now this is really useful because what you want to see is what values are coming in. So trace output of webhook. You know, and if you wanted to do something more involved, which meant you were interacting with Azure resources, then you just kind of need to know what you want to do. For example, if I went to look for an operation for a virtual machine or rather VM, then I can see it returns the commandlets that are related to it. So for example, if I wanted to just use the get Azure VM commandlet or the RM-based VM commandlet or one of the other ones, then I can easily search for them, import them into the Canvas.
319.1
What this also allows you to do is create sequence outputs as well. So it doesn’t have to be one big sequence workflow. You could split this workflow into two separate streams as well. So maybe I add this here as well and then just simply fork that out into two outputs. So the benefit here is the graphical user interface really allows you to kind of imagine and work through the requirements for your workflow and then easily being able to search for the commandlet that are relevant to you and kind of find them and add them and build that workflow yourself without really knowing too much PowerShell to begin with. So no excuse for not getting started with Azure Automation, then.
368
But what happens when there are problems, right? What happens? How do you troubleshoot? How do you get to the bottom of why your jobs are failing? So let’s just spend 30 seconds looking at the options for debugging, troubleshooting, that are available within the Azure automation. So let’s just take one of the existing runbooks that I’ve got here like this one– find MT resource groups within my Azure subscription. Now when this script appears on your screen, on the left panel, if you scroll down, you will see an option for logging and tracing. Now at every runbook, you have an option to enable logging, you know, log process records at the same time.
408.8
If you see failures, then you could elevate the type of tracing set up to be detailed. And this really, really helps you get very informative line by line execution details. So let’s click Save. And effectively, next time the script gets run, all the steps are instrumented, and I can see exactly what’s going on. So if my script fails, I can see the variable values and the ins and outs. So I can figure out where the problem is. Now if you’ve run a script already and you didn’t have logging enabled or you just wanted to go back and see what the output of that script was, then all of that is centrally preserved at the Azure automation account level.
449
So if I go back a few steps into my Azure automation account, over here, you see the jobs tile. If I click on the jobs tile, then from within this tile, I can see a record of all the historic job execution within this automation account, especially the one that we just ran a little while back, right? Get the VM details, for example– that successfully completed. I can click on output to see what all the output steps. At the same time, I can go back in and see that some warnings have been recorded.
485.4
So within this warning, I can see it’s telling me that my script relies on a step or a commandlet which is bound to be deprecated in the near term. So that’s a warning signal. I can go back and fix it as well. You know, I can see all logs as well. And this is really, really useful. Because I turned on Verbose on that specific execution, I can see each step of the execution. And again, it really, really helps you identify where the problem and the failure is during your troubleshooting. All right, so with that, we’ve looked at Azure automation.
523.7
In this module, we heavily focused on the runbook aspect of Azure automation, the different types of run books, and we have seen how to troubleshoot failing runbooks as well. So that’s it– signing off for module one

If you are new to PowerShell but still want to use Azure Automation, assembling runbooks from the graphical user interface is the place to start. By using the graphical user interface, you can learn Powershell at your own pace.

This video demonstrates how to author and edit graphical runbooks. This will help you understand the functioning of Azure Automation and runbooks. You will get more familiar with the integrated PowerShell development environment, and over time, you’ll be prepared to migrate to core-based PowerShell runbooks.

Join the discussion

What are the benefits of using graphical runbooks? Would you recommend that a newcomer to PowerShell start with graphical runbooks?
Use the Discussion section below and let us know your thoughts. Try to respond to at least one other post and once you’re happy with your contribution, click the Mark as complete button to move on to the next step.
This article is from the free online

Microsoft Future Ready: DevOps Development, Implementation and Azure Automation

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education