shlogg · Early preview
Olivier Miossec @omiossec_med

Avoiding Syntax Errors In Azure Policy With PowerShell And Pester

Avoiding Azure Policy errors with PowerShell: Test JSON syntax, displayName, if/then clauses, effect, mode & parameter usage with Pester framework.

I write a lot of custom Azure Policy, and like everyone, I believe, I made some mistakes, and I want to avoid waiting until I try to deploy policies to catch these errors. 
But what kind of error to avoid, in Azure Policy editing there are 3 levels of errors:

Syntax error, when you have a malformed JSON document or a mistake in your parameter
Integration error, when something doesn’t work in the Policy, an object type that doesn’t exist for example
Logical error, when you can deploy and assign the policy, but the policy doesn’t work as expected

Let’s try to address the first problem. What ca...