Azure Automation - Import PowerShell Runbook From Portal Gallery

In our previous article (listed below), we have learned the basics of Azure Automation along with authoring a basic Runbook, that displays a hard coded text “Hello World:”

Navigate to the essentials tab of Azure Automation account by clicking on the account name in the list of Azure Automation Account shown below:

Account
Click on the account. You will be taken to the essentials tab of the Automation account, as shown below:

Account

Click Runbooks tile, as shown in the above screenshot. You will be taken to the list of Runbooks, that were already created.

Runbooks

Now, click on the “Browse Gallery”, as shown in the screenshot, given above. You will be taken to the “Browse Gallery” blade, where you can see all Runbooks available in the Azure portal gallery. These are developed by Microsoft as well as the community. You can choose the Runbook that suits your requirement.

For the sake of simplicity, I have taken a very small Runbook, that just prints the “Hello World” text message. However, it also takes an input parameter and displays the same along with the Hello World text.

Hello World

Clicking the above Runbook displays another blade named “View Source”, which is shown below:

View Source

Now, click the “Import” button, as shown below. Basically, you are just downloading PowerShell script from the Portal Gallery to your Automation account.

As soon as you click on the “Import” button, it will prompt you for a name and description. Please provide the meaningful name, as shown below:

Import

Now, click “OK”. After a couple of seconds, Runbook gets imported to your account and will be opened in Edit mode, as shown below:

Edit

Now, click “Edit” link view (or edit) Runbook, as shown below. The PowerShell Code Editor displays the PowerShell Workflow code, as shown below:

Edit

Now, click Publish button and a confirmation box is displayed, as shown below:

Publish

Now, click “YES” and after few seconds, it gets published and all the buttons of Runbook get enabled so that you can start the Runbook, as shown below:

start

On clicking “Start” button, you will be prompted to provide an input for the input parameter Name, as shown below:

Start

I entered “Prawin Sreeram”, as shown above and clicked “OK” button.

Runbook gets queued, as shown below:

queued

After a few seconds, its status changes to “Completed”.

Completed

Now, click on the “Output” tile, which is shown below:

Output

You will see the output “Hello” along with the name entered, as shown in the screenshot, given below:

Output