Azure DevOps missing PR annotations

Template for a good new topic, formatted with Markdown:

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps)

Azure DevOps Services

  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI

Azure DevOps Services

  • Scanner command used when applicable (private details masked)

dotnet sonarscanner begin /k:"$SONAR_PROJECT_KEY" /o:"$SONAR_OGRANIZAION" /"$SONAR_HOST_URL" /d:sonar.login="$SONAR_TOKEN" /d:sonar.cs.opencover.reportsPaths=/coverage.opencover.xml /d:sonar.pullrequest.key="$PR_ID" /d:sonar.pullrequest.branch="$BRANCH_NAME" /d:sonar.pullrequest.base=“master”

dotnet sonarscanner end /d:sonar.login="$SONAR_TOKEN"

  • Languages of the repository


  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)

No error. SonarCloud correctly shows the Pull Request results on All looks good besides the fact that the Azure DevOps PR doesn’t have any SonarCloud annotations/comments (even though there were findings on for that PR build).

  • Steps to reproduce

I followed instructions from the following sources:

I configured project in “General Settings | Pull Requests” to use provider “Azure DevOps Services” and provided a PAT token (with authorization scope: “Code (read and write)”. I even tried to use a PAT token with “full access”).

Above you can see the “dotnet sonarscanner” commands that I ran.

SonarCloud extension is installed and shows version: 1.20.1 (Latest)

We’re on a paid plan of SonarCloud.

There is no warning label on web UI like “Last analysis had 1 warning” or similar.

Maybe worth mentioning: The solution is built as part of a Docker build with “dotnet sonarscanner” executed as part of the Docker image build. I am copying “.git” folder into the Docker image so that the scanner can retrieve info about e.g. author of changes (and they are correctly reflected on the report page). IOW I’m not using the SonarCloud Azure DevOps pipeline tasks but instead the “dotnet sonarscanner” tool inside the Docker image build.

Any suggestions on what I’m doing wrong? Or is there a way to see some logs that would point me in the right direction?

I have reviewed posts that looked similar to my issue, but unfortunately I wasn’t able to address my issue:

Hi @alecor191 and welcome to the community !

Can you provide us a background task id of a PR analysis please ? You can find one of them in the “Administration → Background tasks” menu of your project.

Thanks !

Thanks a lot @mickaelcaro for getting back to me so quickly.

Here the requested background task id: AXeBdyFSnL2xaJPm6vPu

It correctly shows up as a PR run with 7 findings. But there are no SonarCloud messages/comments in the Azure DevOps PR.

Thanks @alecor191

We’re investigating the issue right now.

Hi @alecor191

So after reviewing the logs, you are missing some required arguments in the scanner command line to have proper decoration of your PR.

We know that this is not logged as expected and should at least raise some warning, we’re working on it.

In the mean time, you can have a look at what we do in the Azure DevOps extensions, especially those properties

  • sonar.pullrequest.vsts.instanceUrl
  • sonar.pullrequest.vsts.project
  • sonar.pullrequest.vsts.repository


Thanks a lot @mickaelcaro, that was it! Adding those 3 parameters addressed the issue and now I get comments added to the Azure DevOps PR.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.