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:
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 personal access token and copy it. For more information about tokens, see Managing Personal Access Tokens.
In your Azure DevOps project, go to Project Settings > Service connections.
Select New service connection and then select SonarQube Cloud from the service connection list.

Set the parameters:
In Region (optional) field: If you use the SonarQube Cloud’s US instance, select US. Otherwise, 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).
In the example below, the US instance is used.

Select Verify to verify the connection to the SonarQube Cloud's instance.
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 Setting up Azure DevOps integration for your project 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:
Select Edit to modify your build pipeline.
Go to the Triggers tab.
Select the correct repository under Pull request validation.
Select Enable pull request validation.
Set up the branch filters: Note that this is the target branch of the pull request. See the Microsoft documentation for more details.
Select Save to update your pipeline.
Related pages
Related online courses
Last updated
Was this helpful?

