Azure DevOps Microsoft-Hosted Agents integration with SonarQube On-premise Server

Current Setup:
We are using Azure DevOps services for our build and we are using MicrosoftHosted agents for this.
We have installed SonarQube Enterprise Edition Version 9.0.1 (build 46107) in one of our On-Premise servers. This server is not exposed to the public and is accessible only within our Organization network.

Issue Description:
When we are running our Code analysis as part of our build, we are getting errors when connecting to the SonarQube instance. As per the documentation it is clearly stated and mentioned earlier that SonarQube will work for both On-perm and Cloud.
SonarQube documentation

What we are trying to achieve:
Below are our constraints:

  • We will not be able to change the build pipeline agents
  • We have security constraints on opening the Server to the public internet for Azure DevOps agents to access.

As per the documentation, we assumed this is something that can be achieved using some agents and currently we are booked in using SonarQube in our Org. even though we have an Enterprise license.

So we are looking for the best way to integrate Azure DevOps MicrosftHosted agents with SonarQube on-premise server.

Hi @jobin ,

Welcome to SonarSource Community! :sonarsource:

Sorry for the delay. Can you please attach the logs from your build that show the errors? Screenshots will be helpful if you believe so.

Hi @Joe,
Please find the logs that we are getting in Azure DevOps when running the task, Prepare analysis on SonarQube.

Kindly let me know if you need any more details.

Starting: Prepare analysis on SonarQube
Task : Prepare Analysis Configuration
Description : Prepare SonarQube analysis configuration
Version : 4.22.0
Author : sonarsource
Help : Version: 4.22.0. More Information
==============================================================================
##[error][SQ] API GET ‘/api/server/version’ failed, error was: {“code”:“ENOTFOUND”,“errno”:“ENOTFOUND”,“syscall”:“getaddrinfo”,“hostname”:“sonar...com”,“host”:“sonar...com”,“port”:443}
Finishing: Prepare analysis on SonarQube

Hi @jobin ,

This error indicates that the remote address cannot be resolved from the Microsoft-hosted agent (sonar.**.**.com cannot be resolved to an IP Address, and communication with the server cannot take place). This error is unlikely related to SonarQube.

What happens if you run a command such as the following from your build agent?

nslookup sonar.**.**.com

Please let me know when you have the data and I can message you directly and we can start a private thread.

Please also provide logs from the build where this failure is occurring. I need to verify you are seeing the same problem as I am.

Hi @Joe ,

I have tried running nslookup and I could see the error as ** server can’t find sonar...com: NXDOMAIN.

Sure, You can message me directly to proceed further.

Thanks