Fail Azure DevOps Pipeline on SonarCloud Quality Gate Failure

Hello,

I am using an Azure DevOps pipeline and I want the pipeline to fail automatically whenever the SonarCloud Quality Gate fails. Could someone guide me on how to implement this?

Thank you in advance!

Hey there.

You’re looking for sonar.qualitygate.wait=true!

Concretly that maens doing something like this:

- task: SonarCloudPrepare@3
  displayName: Prepare Analysis Configuration task
  inputs:
...
    extraProperties: |
      sonar.qualitygate.wait=true