I'm trying to setup a test environment to experiment with SonarQube. This are the steps I took so far:
Downloaded and installed SonarQube. I am able to run it, navigate to http://localhost:9000
Created a new project for a repo in Azure DevOps. Sonar is able to connect to it, read the repositories, etc.
Donwloaded the latest version of SonarScanner.MsBuild runner. Unzipped and put the path into the %PATH% environment variable
In sonar I created a new User Token and put in the
SonarQube.Analysis.xmlfrom the runner folder:<Property Name="sonar.host.url">http://localhost:9000</Property> <Property Name="sonar.login">admin</Property> <Property Name="sonar.password">sonar</Property> <Property Name="sonar.token">squ_7b.......601</Property>Back to Sonar, I created a new local run.
Selected the option to
Generate a project tokenand clicked NextThen Sonar is asking me to run the following command:
SonarScanner.MSBuild.exe begin /k:"TEST_PROJECT-local" /d:sonar.host.url="http://localhost:9000" /d:sonar.token="sqp_ec60....a7e1"
I can see the project token was create by Sonar. But when I run it, I get the following error:
SonarScanner for MSBuild 5.13
Using the .NET Framework version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
09:15:30.629 Updating build integration targets...
09:15:30.797 Unauthorized: Access is denied due to invalid credentials. Please check the authentication parameters.
09:15:30.8 Pre-processing failed. Exit code: 1
What am I missing?

Try deleting these 2 lines
from your
SonarQube.Analysis.xmlfile.I was having the same problem and was able to resolve it by doing that. I think the issue is related to the scanner attempting to use login and password when they are present, but if the token is listed you should really just use that to authenticate.