I’m using
- SonarQube Enterprise Edition 9.9 (65466) and
- SonarScanner for MSBuild 5.13.1
TL; DR
SONAR_TOKEN does not seem to work in sonarscanner for MSBUILD, even though it says it should
Problem statement
I’m trying to perform a Sonar scan of a dotnet core project against a SonarQube server that needs authentication. According to the documentation here SonarScanner for .NET I can either provide the token using the sonar.token property or create the SONAR_TOKEN environment variable and set the token as its value.
I have tried both ways. Using sonar.token works fine. Setting the environment variable SONAR_TOKEN seems to have no effekt at all - the build fails due to authenication issues.
Commands being run*
dotnet new tool-manifest
dotnet tool install dotnet-sonarscanner
dotnet sonarscanner begin ........
...
I have tried the same command successfully when the authentication on the server has been turned off. And when authenication is turned on, it works if I add -d:sonar.token=$SONAR_TOKEN
Question
Should SONAR_TOKEN work or is the documentation wrong? Or did I do something wrong?