

The names of all outputs the ARM template should contain (optional). child resources defined in the templates are not supported. The list of resources (of its type) the ARM template should contain. The list of all the functions (mber) the ARM template should contain (optional). The names of all variables the ARM template should contain (optional). The names of all parameters the ARM template should contain (optional). The path to the ARM Template that needs to be tested against. To test your template using this script, you will need to pass the following parameters in: Using this Pester test script, I can either be very strict and ensure ALL the elements listed above must be defined (and nothing else), or be less restrictive, only test against the required element (resources) and one or more optional elements (parameters, variables, functions and outputs). This template has the following elements defined:

Test if the ARM template is a valid JSON file.The pester test I wrote performs the following tests:

I like the idea, but since I didn’t bother (and couldn’t) keep a copy of the code, I wrote my own version, with some improvements and additional capability. To cater for this requirement, an engineer from the customer’s own cloud team has written a Pester test that validates the content of the ARM templates by parsing the JSON file. One of the scenario we had to cater for is: How can you ensure the ARM template you are deploying only deploys the resources that you intended to deploy? In another word, if someone has gone rogue or mistakenly modified the template, how can you make sure it does not deploy resources that’s not supposed to be deployed (i.e. I once even wrote a standalone pipeline only to perform Pester tests. During this engagement, everyone in the project team had to write tests for any patterns / pipelines they are developing. I just finished up a 12 months engagement with a financial institute here in Melbourne. It is fair to say, I have spent a lot of time on Pester lately. Pester Test Your ARM Template in Azure DevOps CI Pipelines
