ERROR: Error during SonarScanner execution ERROR: Not authorized. Please check the properties sonar

Hello,
I was trying to integrate Sonarqube with an AngularJS application and got the following error:

##[error]ERROR: Error during SonarScanner execution
ERROR: Not authorized. Please check the properties sonar.login and sonar.password.
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
ERROR: Error during SonarScanner execution
ERROR: Not authorized. Please check the properties sonar.login and sonar.password.
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
INFO: ------------------------------------------------------------------------
##[error]The process 'D:\a\_tasks\SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055\5.6.1\sonar-scanner\bin\sonar-scanner.bat' failed with exit code 1

Initially the build pipeline works fine until the task “Prepare Analysis Configuration” but I get the above error for the task “Run Code Analysis”.
Could not find a proper fix. Can anyone help me asap?

Hi,

Welcome to the community!

The error is:

What do you make of that?

 
Ann

Hello Ann, did not understand your question?

Hi,

What do you think the error message means?

 
Ann

It says Not Authorised. So it is an authorisation error. But we are using a global access token on sonar and it is not getting used by the sonarqube. Do you have any fix?

Hi,

You need to take a look at the user the token is from. Does that user have permissions to analyze that project? It’s possible for even a global admin to not have permissions on a specific project. (The global admin has access to re-grant him/herself rights, but it’s possible not to have them.)

 
HTH,
Ann

Yes the global token has all required permissions for performing the tasks. The thing is sonar integration works fine for another project developed through .net but for all the angular or JS based applications it gives the above mentioned error.

Hi,

Have you explicitly verified that the account has Analysis permissions on that specific project?

Also, can you share the full analysis log, starting from the analysis command? TBH, I don’t expect to find much in it, but there’s a possibility.

 
Ann