Press "Enter" to skip to content

Validate (all) your Sitecore ARM templates on build

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.

One Comment

  1. Johcn Johcn

    You have good blog post.
    Unfortunately your blog has some issues with RSS and it does not work with Feedly.

Leave a Reply to Johcn Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.