Not authorized when building from Azure DevOps Server (On-premise)

Our build logs now contain entries that look like:

INFO: Found an active CI vendor: ‘Azure DevOps’
INFO: Inferred api base url 'https://api.sonarcloud.io’ from host url 'https://sonarcloud.io’.
INFO: Inferred api base url 'https://api.sonarcloud.io’ from host url 'https://sonarcloud.io’.
ERROR: Error retrieving feature flags, using default analyzer behavior
Not authorized or project not found. Please check the ‘SONAR_TOKEN’ environment variable, the ‘sonar.projectKey’ and ‘sonar.organization’ properties, or contact the project administrator to verify the token’s permissions.
ERROR: Error retrieving feature flags, using default analyzer behavior
Not authorized or project not found. Please check the ‘SONAR_TOKEN’ environment variable, the ‘sonar.projectKey’ and ‘sonar.organization’ properties, or contact the project administrator to verify the token’s permissions.

This is with no changes on our side.

We have tried updating the Token used, but that doesn’t seem to work.

We have noticed that even though we have configured our side to use a token that we receive a warning in SonarQube Cloud regarding username and password.

We are using the official extension for Azure DevOps Server.

Hello @TimBarnett ,

Can you share the azure pipeline yml you are using? Can you make sure you are using SonarCloudPrepare@4, SonarCloudAnalyze@4, and/or SonarCloudPublish@4? This should the ADO SonarQube task to use for SonarQubeCLoud and the latest version as of today.

If you still have problems, please share your pipeline and logs here or let me know if you prefer to share them privately.

Changing to SonarCloudPrepare@4, SonarCloudAnalyze@4, and/or SonarCloudPublish@4##[warning]There is a dedicated extension for SonarCloud: SonarQube Cloud - Visual Studio Marketplace

##[warning]This task is deprecated. Please upgrade to the latest version. For more information, refer to Azure DevOps Extension | SonarQube Server | Sonar Documentation

##[warning]Error while executing SonarQube:Prepare task: [SQ] Unknown scanner mode: undefined

##[error][SQ] Unknown scanner mode: undefined

Finishing: SonarQube: Prepare analysis

This is on Azure DevOps Server (on premise).

We have switched from using the extension to using the dotnet sonarscanner CLI instead, and this has resolved this issue for us.