Setting up project integration

This page explains project-level settings required if you use Azure Pipelines for your project analysis.

Adding SonarQube service connection to Azure Pipelines (SonarQube endpoint)

Service connections are authenticated connections between Azure Pipelines and external or remote services. You must declare your SonarQube Cloud as a service connection in your Azure DevOps project.

Proceed as follows:

  1. In SonarQube Cloud, create an authentication token that will be used by Azure DevOps to execute the analysis of your project in SonarQube Cloud. To do so, create a token and copy it. For more information, see:

  2. In your Azure DevOps project, go to Project Settings > Service connections.

  3. Select New service connection and then select SonarQube Cloud from the service connection list.

Search for "sonar" when adding a new service connection to your Azure DevOps pipeline.
  1. Set the parameters:

    • In Region (optional) field, make sure Global is selected (default value).

    • In SonarQube Cloud Token, enter the token created in the first step.

    • In Service Connection Name, enter a memorable name (You will need this name when configuring your Azure build pipelines).

  2. Select Save to save your connection.

Enabling the pull request analysis in your build pipeline

The Azure DevOps extension running in your Azure pipeline can automatically detect branches or pull requests being built (you don't need to pass them as parameters to the scanner).

To enable the pull request analysis in your Azure pipeline of code stored on Azure DevOps, you must configure a pull request trigger on the target branch (main development branch) as explained on the Azure DevOps page. If your code is stored on GitHub or Bitbucket Cloud, open the expandable content below.

GitHub or Bitbucket Cloud

To configure a pull request trigger in your Azure build pipeline for code stored on GitHub or Bitbucket Cloud:

  1. Select Edit to modify your build pipeline.

  2. Go to the Triggers tab.

  3. Select the correct repository under Pull request validation.

  4. Select Enable pull request validation.

  5. Set up the branch filters: Note that this is the target branch of the pull request. See the Microsoft documentation for more details.

  6. Select Save to update your pipeline.

Last updated

Was this helpful?