Doing some work with a customer around Azure Automation. Here’s some links and resources that I’ve found very helpful as I’m levelling up. Powershell is tried and true and for customers that use scripting / runbooks for building out infrastructure, you don’t have to leave CI/CD at the door. I love the DevOps stack here around YAML pipelines in ADO, Pester, package management, full auditing and rollbacks. I’ll be adding to this over the next few weeks but I’d love your thoughts and additions.
- Starting out? Begin here with a short Powershell walkthrough on MSLearn, Creating your first pipeline using YAML pipelines (this one uses a Java repo)
- Ready to start building in some CI/CD? Andrew Matveychuk’s sample CICD project around Powershell automation. Uses PSDeploy, which he found well documented and extensible. See this:
- There’s a series that Andrew wrote on this that I quite like. Here’s one on accessing a private Powershell repo from Azure Pipelines for example. Another, more complete example, this repo (link here)uses the Pester test framework – written in Powershell! It also uses PSScriptAnalyzer to check for coding standards (in this case just static code analysis). The project is built using InvokeBuild. All build dependencies handled by PSDepend, and Azure Pipelines perform all the tasks around test / build / publishing (see azure-pipelines.yml). With ADO you can use Azure Artifacts to host a private or public PS repository for your modules (samplemodule.nuspec). This is how you get rollbacks etc.

- Andrew did the best writeup I’ve seen yet on DevOps in Powershell. (this is Mar 2020 but all still valid). This includes
- Version control with GitHub or Azure Repos.
- Test automation – we at MSFT favor Pester. Including code coverage analysis (which can be published with each build as a Publish Test Results Task in Nunit format)
- PSScriptAnalyzer for static code analysis and even custom rules
- InvokeBuild (or psake) for build.
- Package Management – use PSDepend to track project dependencies in a simple PS data file.
- Documentation using PlatyPS – and I think GH Copilot can greatly help us here as well.
- CI/CD using Azure Pipelines to fire off a Powershell task (or Azure Powershell task for Azure environment runs). (This used in conjunction with INvokeBuild)
- Artifact Management for reusability. (NOTE I think this is 300 level stuff. We have to walk before we can run!)
- The official MSFT documentation around Powershell runbooks and Azure automation. I would suggest starting with the MSLearn tutorial to create a Powershell runbook in Azure Automation that uses a managed identity. I haven’t looked at the PS Workflow runbook sample yet, that uses the Azure CLI / text editor to run. It has some known limitations, the most serious is not supported in PS 7+.
- An alternative way (possibly more modern) is to call Powershell scripts using a Function app. This can be debugged locally. Here’s an example showing a function app that uses CD from a public GH repo, using the New-AzResourceGroup cmdlet etc.
- Less helpful but still a good reference – MSLearn on Powershell scripts to add business logic to Azure Pipelines. For example the Powershell@2 task. The sample code applies a build number to assemblies.