ERROR: Not authorized in SonarQubeAnalyze plugin

I have SonarQube 9.1 on a VM in Azure. There is also an nginx-server on that VM which provides HTTPS support via reverse proxy (yes, I use LetsEncrypt certificates, but SonarQubePrepare now works). My code is on GitHub, and I trigger a check via Azure Pipelines:

trigger:
- master
- dev

pool:
  vmImage: ubuntu-latest

variables:
- name: NODE_OPTIONS
  value: --use-openssl-ca

steps:
- task: SonarQubePrepare@4
  inputs:
    SonarQube: 'SonarQube TLS'
    scannerMode: 'CLI'
    configMode: 'file'
    projectName: 'MyPorject'
    projectKey: 'My-Project'
- task: SonarQubeAnalyze@4
- task: SonarQubePublish@4
  inputs:
    pollingTimeoutSec: '300'

When the pipeline starts, the SonarQubePrepare stage passes, but then I see the following error message:

2021-10-14T15:19:37.8796742Z ##[section]Starting: SonarQubeAnalyze
2021-10-14T15:19:37.8806358Z ==============================================================================
2021-10-14T15:19:37.8806742Z Task         : Run Code Analysis
2021-10-14T15:19:37.8807128Z Description  : Run scanner and upload the results to the SonarQube server.
2021-10-14T15:19:37.8807483Z Version      : 4.23.1
2021-10-14T15:19:37.8807725Z Author       : sonarsource
2021-10-14T15:19:37.8808364Z Help         : Version: 4.23.1. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
2021-10-14T15:19:37.8809103Z ==============================================================================
2021-10-14T15:19:38.0737542Z [command]/home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.23.1/sonar-scanner/bin/sonar-scanner
2021-10-14T15:19:38.3551834Z INFO: Scanner configuration file: /home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.23.1/sonar-scanner/conf/sonar-scanner.properties
2021-10-14T15:19:38.3579909Z INFO: Project root configuration file: /home/vsts/work/1/s/sonar-project.properties
2021-10-14T15:19:38.4116731Z INFO: SonarScanner 4.6.2.2472
2021-10-14T15:19:38.4122735Z INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
2021-10-14T15:19:38.4125083Z INFO: Linux 5.8.0-1042-azure amd64
2021-10-14T15:19:38.9593061Z INFO: User cache: /home/vsts/.sonar/cache
2021-10-14T15:19:40.4058485Z INFO: Scanner configuration file: /home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.23.1/sonar-scanner/conf/sonar-scanner.properties
2021-10-14T15:19:40.4062252Z INFO: Project root configuration file: /home/vsts/work/1/s/sonar-project.properties
2021-10-14T15:19:40.4314198Z INFO: Analyzing on SonarQube server 9.1.0
2021-10-14T15:19:40.4352622Z INFO: Default locale: "en", source code encoding: "UTF-8"
2021-10-14T15:19:40.9068063Z INFO: Load global settings
2021-10-14T15:19:41.0543719Z INFO: ------------------------------------------------------------------------
2021-10-14T15:19:41.0597845Z INFO: EXECUTION FAILURE
2021-10-14T15:19:41.0637104Z INFO: ------------------------------------------------------------------------
2021-10-14T15:19:41.0637932Z INFO: Total time: 2.713s
2021-10-14T15:19:41.0857735Z INFO: Final Memory: 5M/20M
2021-10-14T15:19:41.1006998Z INFO: ------------------------------------------------------------------------
2021-10-14T15:19:41.1046715Z ##[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.
2021-10-14T15:19:41.1058323Z ERROR: Error during SonarScanner execution
2021-10-14T15:19:41.1058842Z ERROR: Not authorized. Please check the properties sonar.login and sonar.password.
2021-10-14T15:19:41.1059249Z ERROR: 
2021-10-14T15:19:41.1060046Z ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
2021-10-14T15:19:41.1242721Z ##[error]The process '/home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.23.1/sonar-scanner/bin/sonar-scanner' failed with exit code 2
2021-10-14T15:19:41.1275096Z ##[section]Finishing: SonarQubeAnalyze

My sonar-project.properties is rather empty:

sonar.projectName=MyProject
sonar.projectKey=My-Project
sonar.sources=.
sonar.sourceEncoding=UTF-8

I tried to add sonar.login=my-token-blah-blah there, with a plain-text token (which is bad, but just to try it out), but it didn’t help. Maybe that was a wrong token.

It is important to say that it used to work nicely before I switched to HTTPS.

Could someone say what I’m doing wrong here?

Okay, I found the solution: Sonar Scanner error in Azure DevOps - ERROR : Not authorized. Please check the properties sonar.login and sonar.password - Stack Overflow

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.