Validate (all) your Sitecore ARM templates on build


BACK TO BLOG OVERVIEW


While working with ARM templates and Azure DevOps it definitely adds value to validate all your Json files during build. This might save you a lot of time. To implement this you could setup the following tasks within your build pipeline:

Add a ‘npm’ task within your build and configure it as below:

Now add a subsequent Powershell task, run it inline and add the following script:

get-childitem -Recurse -Filter *.json | ForEach-Object { Write-Host “Checking file: $($_.FullName)” “node $env:appdata\npm\node_modules\jsonlint\lib\cli.js $($_.FullName)” }

Set the following values within the advanced properties of your task:

Resulting in the following (basic but self-explanatory example) build pipeline:

Now all of the *.json files within the repository will be validated upon build, saving you the ignorant feeling of finding out while deploying/releasing.