Search code examples
powershellazure-devopsexit-codems-release-managementazure-pipelines

Azure Powershell VSO agent task not failing for non-zero exit code


When putting together a release definition in VSO, adding an Azure PowerShell task backed by a file Script1.ps only containing exit 1 does not fail the step when it runs - which I would expect it to do, given that the Continue on error box is not checked If I add the PowerShell task, writing exit 1 using the inline variant would indeed fail the step. This also comes with an 'advanced configuration option' where the Fail on Standard Error is checked by default.

What did I miss? How would I go about making the Azure Powershell fail in the same manner?


Solution

  • Using this code instead:

    [Environment]::Exit(1)