PullRequest failed to update the PR Status in SonarQube

  • Developer Edition Version 8.2 (build 32929)
    *Azure Devops Server : Version Dev17.M153.5

Trying enable the PullRequest Code Analysis in Azure Devops. So that every PullRequest should trigger the sonarqube code analysis and report quality gate status back into PullRequest in Azure DevOps(TFS)

what we have configured so far: Attached the screen shot.
(upload://4TkF0lc6oP7v6Qu9ayERpoISFC0.png) ISFC0.png)

When we ran the job we are getting the below Error

2020-04-09T15:10:48.2179674Z ##[error]ERROR: Error during SonarQube Scanner execution
ERROR: A pull request analysis cannot have the branch analysis parameter 'sonar.branch.name'

When we ran the pipeline job with the Below Additional Parameter the job runs but not updating “SonarQube” PullRequest


The Analysis job runs for the when look at the log it’s taking the target branch in this case :Develop
Not the PR/Feature branch for code analysis Is there any reason ???

Attached screen shot of logs for your reference. (Removed Project key from logs for security purpose)

2020-04-09T11:18:04.3212168Z INFO: Load plugins index

2020-04-09T11:18:04.3655496Z INFO: Load plugins index (done) | time=44ms

2020-04-09T11:18:04.4810073Z INFO: Load/download plugins (done) | time=159ms

2020-04-09T11:18:04.7009266Z INFO: Loaded core extensions: developer-scanner

2020-04-09T11:18:05.1926904Z INFO: Process project properties

2020-04-09T11:18:05.2035531Z INFO: Process project properties (done) | time=11ms

2020-04-09T11:18:05.2036972Z INFO: Execute project builders

2020-04-09T11:18:05.2080571Z INFO: Execute project builders (done) | time=4ms

2020-04-09T11:18:05.2129446Z INFO: Project key:
2020-04-09T11:18:05.2129904Z INFO: Base dir: 

2020-04-09T11:18:05.2129972Z INFO: Working dir: E:\Agents\EnterpriseFoundations\_work\r81\a\.scannerwork

2020-04-09T11:18:05.2796700Z INFO: Load project settings for component key: '

2020-04-09T11:18:05.3034706Z INFO: Load project settings for component key: '
' (done) | time=24ms

2020-04-09T11:18:05.3596698Z INFO: Load project branches

2020-04-09T11:18:05.3762524Z INFO: Load project branches (done) | time=16ms

2020-04-09T11:18:05.3769324Z INFO: Load project pull requests

2020-04-09T11:18:05.3903086Z INFO: Load project pull requests (done) | time=13ms

2020-04-09T11:18:05.3906230Z INFO: Load branch configuration

2020-04-09T11:18:05.3924564Z INFO: Load branch configuration (done) | time=2ms

2020-04-09T11:18:05.4204821Z INFO: Load quality profiles

2020-04-09T11:18:05.4702956Z INFO: Load quality profiles (done) | time=50ms

2020-04-09T11:18:05.4742516Z INFO: Detected Azure DevOps

2020-04-09T11:18:05.4765295Z INFO: Load active rules

2020-04-09T11:18:06.3390298Z INFO: Load active rules (done) | time=863ms

2020-04-09T11:18:06.3507736Z INFO: Branch name: develop

And Sonarqube Portal the “PullRequest” Tab was showing no entry in it.

Hello @dkori003,

This likely has to do with how your pipeline is run/configured. As you understood, a PR analysis cannot have a sonar.branch.name defined (ie. Branch analysis), as it’s 2 different things, mutually exclusive.

This line in your logs:

2020-04-09T11:18:06.3507736Z INFO: Branch name: develop

confirms that your analysis defined a sonar.branch.name, then was triggered from a branch, not a PR.

Also, sonar.pullrequest.* parameters are automatically configured when the pipeline is triggered from the Pull Request directly, so you should even not add any single parameter.

Is your code stored in an Azure Git repo? In that case you should read PR triggers in order to know how to trigger your pipeline from the PR.

I hope this will help.


Hello @Antoine,
I gone through the link which talks about enabling the Build Validation policy and that seems to be solution for the Build Pipelines and will try out that now. Just One more question I have is, Can this enabled for Release Piepline too? I want do the Build/Deploy as part Release pipeline and want to do sonar scan for all the PullRequest, Is it possible?

What i can see in Branch Policy (Build validation) Only we can select Build Pipeline, Is there way we can have same thing for Release pipeline ?

Say I want to trigger Release Pipeline Once we create PR for develop and as part Release Pipeline i want to do the Sonar scan.

Hello @dkori003,

Honestly I don’t know, you’ll have to ask this to Azure folks, I’m not that familiar with it. What is sure is that if you trigger a pipeline from a PR, and add a SQ scanner in it, it will automatically configure the PR analysis (and decoration if you have the appropriate config on the SQ side).

Hello @Antoine ,

Thank you so much for the information that helped us to configure the Build Pipeline for PullRequest sonar scan.

1 Like