How to Run Azure Automation Runbooks Locally While Accessing Assets

Written by Freddy Mora Silva on Thursday, October 18th 2018 — Categories: Azure, Datacenter Automation

Freddy Mora Silva is Senior Technical Consultant at Infront Consulting. Connect with him on LinkedIn.

When you work with Azure Automation, you might find yourself coding locally, putting all the initial logic into the script, copying and pasting the code to the web to run it, and then testing the code from the portal.

Usually this practice takes longer to execute and will require a printout of variables or comments to follow the code execution, as you are not debugging your script.

There is another, possibly better, way to get your PowerShell code into Azure.

You can install an add-on on your local machine that allows you to connect to Azure and interact with the different automation components. You can easily download and use this add-on locally, giving you the ability to debug your code. It is called Azure Automation PowerShell ISE add-on.

Install it with either of these two options:

You can install the ISE add-on module from PowerShell Gallery with:

Install-Module AzureAutomationAuthoringToolkit -Scope CurrentUser

Then, if you want the PowerShell ISE to always automatically load the add-on, run:

Install-AzureAutomationIseAddOn

Otherwise, whenever you want to load the add-on, just run the following in the PowerShell ISE:

Import-Module AzureAutomationAuthoringToolkit

The add-on will prompt you to update if a newer version becomes available.

 

What can you do with the Azure Automation Powershell ISE Add On?

Once you installed it will appear like this.

powersehll ise addon
We have multiple tabs: Configuration, Runbooks, DSC, Assets and Modules. Let's take a look at each.

Configuration

Here you will sign in to Azure and select the Automation Account you wish to use.

powersehll ise addon configuration
After you log in with your credentials, a folder is created where all components are downloaded.
 

Runbooks

This tab allows you to create, open, download, upload, delete and even test a draft version or a runbook in Azure.

powersehll ise addon runbooks

DSC

This tab allows you to create, open, download, upload, delete and even compile a Desire State Configuration file in Azure.

powersehll ise addon dsc

Assets

I think this is the most important area in the ISE Add-On—you can create, edit locally, download, upload, insert, or delete different assets like Credentials, Connections, Variables, or Certificates.

powersehll ise addon assets

Modules

Like the last one, this is one of the main tabs. It allows you to see, delete, upload and select the storage to use for any module.
powersehll ise addon modulesGet Started

Once you installed and logged in you can test your code with the same commands that you have, and you can easily debug it in the same way as any normal PowerShell code you have built before. Enjoy!

Chat Now