Using Parameters and Outputs in Azure Automation Graphical Runbooks

Author by Duncan Lindquist

In this blog post we will be walking through how to configure your textual runbooks to accept and pass parameters in graphical runbooks. In order to do this we will configure the runbooks to have parameters as well as pass output when they are completed.

Configuring Parameters 

In order to have parameters in your runbook activities in graphical runbooks you will need to set them by editing in the textual mode. In the textual mode add a param block to the start of your runbook. You can use this param block to specify the parameter types, whether they are required and the parameter names. See the picture below for an example:

Azure Automation 4

Now that you have defined your parameters in the textual runbook they will show up in your graphical runbook. You can see them by adding the runbook as an activity, clicking on it then on the right hand navigation select Parameters this will show a list of your parameters.

Azure Automation 5

You will notice in the picture above you can also map a data source to your parameter. We will now walk through the steps to configuring your textual runbooks to output data to be consumed by other runbook activities.

Configuring Output

To configure our runbooks to output data we will need to open the textual version of the runbook and edit it. This time we will be adding an output to the end of our script. This is done by declaring the output type, setting the output variable then doing a write-output.


Now that we have our output variable we can go back to our graphical runbook to pass it to the next item. I the example below I am going to be passing output from the Passing-Parameters runbook to the Left-Path runbook. To do this I select the Left-Path runbook then click on parameters and select the parameter I want to send the output too.


Now to configure the output we are actually going to use the PowerShell expression datasource. To get the output from our previous runbook it just takes a little bit of PowerShell:

write-output $ActivityOutput['RunbookName']

 Replace Runbook name with the runbook you want to pass output from.


Now you can run a test on your runbook and you will see that you are able to pass your variables. In the example my Left-Path Runbook was just set to write-output of the passed variable.Param06

We have now successfully passed data between runbooks in Azure Automation. I will be following up this blog post with more advanced techniques on using the PowerShell expression data source. You may have also noticed the Activity Output data source doesn't give you any information if you click on it currently. With future updates this selection will have many enhancements to allow you to select your output and output properties. Look for many new exciting things to come with the next updates!!


Duncan Lindquist

Service Management & Automation Solution Lead