Setting up project integration
Project-level settings required for Azure DevOps or Azure Pipelines for your project analysis.
Setting up pull request integration with Azure DevOps
SonarQube Server can:
Report the quality gate status and analysis metrics to your pull requests in Azure DevOps.
Show issues detected on a pull request in Azure DevOps. Each issue will be a comment on the Azure DevOps pull request. If you change the status of an issue in SonarQube Server, that status change is immediately reflected in the Azure DevOps interface.
To set up the pull request analysis:
See Prerequisites.
Enable the pull request analysis on the target branch: see below.
If you don't use an integrated CI tool like Azure Pipelines, you must set up the pull request parameters manually: see Setting up the pull request parameters.
For an unbound project, an additional setup is required: see below.
You can prevent the pull request merge if the quality gate fails: see below.
Setting up integration with Azure Pipelines
If you use Azure Pipelines, you must configure a service connection in Azure and enable the pull request analysis in your pipeline.
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 Server as a service connection in your Azure DevOps project.
Proceed as follows:
1. In SonarQube, create an authentication token that will be used by Azure DevOps to execute the analysis of your project in SonarQube. To do so, create a token and copy it. For more information, see Managing your tokens.
2. In your Azure DevOps project, go to Project Settings > Service connections.
3. Select New service connection and then select SonarQube Server from the service connection list.

4. Enter your SonarQube Server URL, the token created in the first step, and a memorable Service connection name (You will need this name when configuring your Azure build pipelines). Then, 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 above in Enabling pull request analysis on target branch. If your code is stored on GitHub or Bitbucket Cloud, see below.
Related pages
Last updated
Was this helpful?