Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project Not authorized. Please check the properties sonar.login and sonar.password

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    plug in from AzureDevops Market Place

  • what are you trying to achieve
    i am trying to scan the code through AzureDevops(VSTS) build pipeline

  • what have you tried so far to achieve this
    i using 3 steps

  1. Prepare analysis on SonarQube, i am using this task with sonarqube service end point which has token

  2. Maven Steps under maven are below
    Run SonarQube or SonarCloud analysis
    Sonarqube version for Maven is latest

  3. Publish Quality Gate Result

I am getting below error. i did check the forum and no luck.
Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project Not authorized. Please check the properties sonar.login and sonar.password

Hello Kamalakar,

You say the SonarQube Server Endpoint is configured with a token. Can you double-check that the token used corresponds to a user who has “Execute Analysis” global permission in your SonarQube instance? Or, if the project already exists, check that the token corresponds to a user who has “Execute Analysis” permission on that specific project.

Hope this helps,
Jeff

Jeff, The token used by the user is having the execute analysis permissions.
i am still seeing the same issue.

Is your pipeline a classic pipeline or YAML/configuration as code pipeline? Can you paste the specifics of your Prepare Analysis and maven execution tasks?

Thanks Jeff, I was able to fix the issue.

In case it’s helpful to others who find this thread via search in the future, would you mind replying with what the root cause & resolution were @kdevar?

Thanks!

Hi Jeff,

Im facing the same issue. The error is exactly the same and the scenario is same as well. I use a YAML editor. Can you please help…