Do proxy settings work with MSBuild Sonar Scanner?

Hello,

  • SonarQube version: 7.9.3
  • SonarScanner for MSBuild: 4.10

My team is trying to run sonar analysis from a build machine behind the company proxy to a sonarqube instance on the cloud.
We tried to provide the proxy settings in SONAR_SCANNER_OPTS environment variable:

SONAR_SCANNER_OPTS="-Dhttps.proxyHost=<host> -Dhttps.proxyPort=<port> -Dhttps.proxyUser=<user> -Dhttps.proxyPassword=<password>" 

but it did not work and still throws this error: The remote server returned an error: (407) Proxy Authentication Required.
Using system level proxy settings is NOT an option for us since those are reset periodically by some policies in our organization.

I came across an issue on msbuild sonar scanner github: https://github.com/SonarSource/sonar-scanner-msbuild/issues/654

  • Could you please confirm if there is indeed an issue with MSBuild sonar scanner wrt specifying the proxy settings in SONAR_SCANNER_OPTS?
  • If it is indeed an issue, when can we expect a resolution to this issue?
  • What are the other ways to provide proxy settings to MSBuild sonar scanner?

Regards,
Shilpa

Hi,

we also had this issue if a proxy server with authentication is required. Seems that the C# part of the scanner is not reading the proxy settings from SONAR_SCANNER_OPTS?

Sonar Scanner fails at begin command with error message HTTP 407 - Proxy Authentication Required

Regards,
Günter

Do we have any resolution to this issue?

Hi,

we did a test with MsBuid.Scanner 5.2.2, issue is still not solved (#47282)

Regards,

Hi

The Scanner for .NET also needs to have the environment variables used by .NET set. I have updated the scanner documentation in the latest version of SonarQube to make this a bit clearer

You also need to set the appropriate proxy environment variables used by .NET. HTTP_PROXY , HTTPS_PROXY , ALL_PROXY , and NO_PROXY are all supported. You can find more details here.

Hope that helps

Tom

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