<p>Am working on Azure Resource Manager Templates(ARM Templates) and VSTS CI&amp;CD. With the help of ARM Templates, I want to deploy AKS (Azure kubernete Service). So before going to deploy, I need to validate my ARM Template in the CI-Build by applying a PowerShell task. But here, at the time of validating my ARM Template “It’s not stopping CI-Build even when the validation fails”. Its giving output as “Validation Completed” as shown in the below picture . Is there any solution to resolve this issue, i.e. I wanted to stop my CI-Build running if any validation fails.</p>

<p><a href="https://i.stack.imgur.com/ExZ9V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ExZ9V.png" alt="enter image description here"></a></p>

<p>Not sure how does your powershell script look like. But according to the screenshot, the powershell script is executed successfully without any error code return. You can update your powershell script to check the validate result and set the exit code to "1" if the result is "InvalidTemplate". This will make the powershell task fail when the template is valid.</p>
