PR Builds failing Code Analysis task while CI builds are working fine

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Languages of the repository: C#
  • SonarCloud project is private
  • Error observed:

Currently all PR builds are failing to execute Code Analysis task due to the error underneath, all CI Builds work fine

1 Like

Hey there.

Please make sure you have a valid token set at either the project-level Administration > General Settings > Pull Requests ) or at the organization-level ( Administration > Organization settings > Azure DevOps connectivity management ). The 401 is being returned by a call being made to Azure DevOps (this token must have permissions to read the Pull Request in question).

If you need the exact URL where the 401 is being returned (from Azure DevOps) to troubleshoot the token, I’m happy to send you the link privately.

1 Like

Thx Colin for the response, but on organization-level I cannot find the Azure Devops connectivity management as shown in following screenshots


On the project level I have set the token from my own user with rights on Code (read&write)

please share the link so I can troubleshoot further

Hey @Bruno-DeWilde

It looks like you’re logged in via a GitHub account. You’ll need to login with Azure DevOps in order to see the right settings menu (this may require granting additional permissions on SonarCloud to the user you login with Azure DevOps).

I’ll message you the link.

The issue was resolved by @Bruno-DeWilde setting a new organization-level token.

And, it seems like setting a new token at the project-level did not work as expected. I’ve reported this internally.

We’ve created a ticket internally to rely on the project-level token (if it exists) for this API call. :tada:

Thanks for raising the issue to our attention @Bruno-DeWilde.

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