Hey everyone! I'm regularly working with some pretty complex automation scripts that need at least PowerShell 7.x and certain modules to run smoothly. I'm wondering how you all tackle source control for your Runbooks. I've been making updates manually, which is getting quite tedious since it feels like source control is locked into the built-in runtime environment (PowerShell 5.1). Has anyone found a way to automatically import Runbooks from Azure DevOps and run them in a specific custom runtime environment, or are you using a different approach altogether?
1 Answer
I created a PowerShell pipeline that takes care of everything needed, including building the ZIP files for modules before they get imported to Azure Automation. For the import process, I use Az.Automation, which has all the tools you need. When it comes to setting runtime environments, you might have to use the API directly until there's more support in Az.Automation for that. I also have a Runbook on GitHub which I made for managing modules with the API. It exposes a function to associate runbooks with runtime environments! Check it out here: https://github.com/mortenlerudjordet/Import-PSGalleryModuleAArte
That sounds interesting! I'm more curious about how you're importing and updating Runbooks through the pipeline. Do you have any hands-on examples?