Azure Automation Release pipeline for Runbooks & Modules

Azure Automation Release pipeline for Runbooks & Modules

June 23, 2026 0 By Morten Lerudjordet

I recently did a refactor of my release pipeline code for azure automation Runbooks and Modules to support Runtime Environments. As this still is not added to the Az-module even as RTE has now been GA for some time.

Therefor I had to write some Powershell functions that uses the ARM REST-api directly instead of Import-AzAutomationRunbook, Publish-AzAutomationRunbook and New-AzAutomationModule i previously used.

One downside of this is one needs to spinn up a public accessible storage account to temporary store the Runbooks and Modules for the ARM-api to consume when publishing to the azure automation account. So therefore the pipeline identity will need rights on the azure automation resource group to be able to create the storage account there. The code will automatically remove the storage account after it is finished. There seems to be no other way around this, and no way of using a more secure storage account config for the ARM-api to use. Though risk should be minimal as the storage account will only exist until the publish logic is done, though if one are publishing a lot of modules this can take some time.

I use azure devops and the traditional release pipeline for running the code, but should run on any tool that can orchestrate calling a powershell script.

To run the script one has to call it with input parameters defined belove.

The code:

Happy tinkering!