When deploying Azure Resources you want to know if all resources are deployed as expected. To check if the resources are correctly deployed you can open the portal and visually inspect the deployed recourses or you can also run some powershell to validate the resources. Why not automate these checks and add them to your deployment pipeline. To validate the resources, I extended the Pester Build Task to connect to Azure. A test that checks the deployment of a VM can look like:
When you are developing Powershell scripts, creating some unit tests will help you in monitoring the quality of the scripts. Writing some tests will give you some assurance that your code still works after you make some changes. Writing Powershell unit tests can be done with Pester. Pester will enable you to test your Powershell scripts from within Powershell. It is a set of Powershell functions for unit testing Powershell. These functions will allow you to mock and isolate the Powershell code under test. When you want to integrate your unit test into your VSTS build pipeline, you need an build extension to run then in your build pipeline.
Continue reading “Powershell Pester in a VSTS build pipeline”