Posted on Leave a comment

Powershell options for tasks – Azure Devops

Powershell is used very often on Azure DevOps tasks, as with it you can implement functionality that is not supported out of the box.

In this article I will explain some options that you may need during your executions.

You can fail a task on Azure Devops with powershell checks. For instance you can integrate your logic and if you get a response that is not the requested you can fail the task.

Fail a powershell task on Azure DevOps

$json = WebServiceCall ConvertFrom-Json
if ($json.value-eq "correct") { Write-Host success }  else { exit 1  }

Continue a failed task on Azure DevOps.

Under control options you should enable continue on error

This will result on a partial success.


Retry a failed task on failure

Run the task under certain conditions

Change working directory of powershell

When running a file path and not an inline script you can also define arguments

Leave a Reply

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