Error - Unauthorized: Access is denied due to invalid credentials

I am trying to run sonar scanner locally on my .net project. But I get “Unauthorized: Access is denied due to invalid credentials. Please check the authentication parameters.” error when I run the command -
SonarScanner.MSBuild.exe begin /k:“XXX” /d:sonar.token=“sqa_XXX”

When I go to sonar cube server - http://localhost:9000 → [Analysis Method] → [Locally] → #Analyze your project, I see the token is valid.

Sonar Cube Version -
Sonar Scanner Version - sonar-scanner-
Local .Net project target framework - net472

Please note -

  1. I installed sonarscanner and unblocked the zip file
  2. I added <INSTALL_DIRECTORY> of sonarscanner to PATH env variable

Would appreciate a quick help on this.


Welcome to the community!

I’m not sure how you could do that since SonarQube never shows token values again after initial creation.

I suggest trying again with a newly-generated token.


This is where can see that the token is valid

And also, same issue with the newly generated token as well.


So… you’re stepping through the wizard to generate a new token?

That wizard generates a project-specific token. You’re not going to be able to use a token generated in this context to analyze random projects. Only the project it was generated for.