I have a self-hosted Windows agent that also has SonarQube Server installed on it. When I add 'Prepare analysis on SonarQube' to a pipeline, it succeeds. When I add 'Run Code Analysis' to that same pipeline, it fails with the error: ERROR: Not authorized. Please check the properties sonar.login and sonar.password. My sonar-project.properties file contains my sonar.projectKey and sonar.login=. I also have tried providing the sonar.login and sonar.password but it still fails. Error image link1
The error message directly mentions you need to check the properties sonar.login and sonar.password.
The credentials have to be under the sonar.
namespace. Please check it.
sonarRunner: {
analysis: {
options: {
...
sonar: {
login: 'admin',
password: 'admin',
host: {
url: 'http://localhost:9000'
},
...
},
...
}
}
}
In addition ,you can refer to the similar case on sonarsource community.