SonarSource/sonarqube · error

Connection to Azure marketplace failed. Details: ${e.message

Error message

Connection to Azure marketplace failed. Details: ${e.message}

What it means

DefaultAzureBillingHandler.handleAzureBillingRequest calls the Azure marketplace billing API; any IOException from that HTTP interaction (connection failure, DNS failure, TLS error, reset connection) is caught and converted into an HTTP 500 response whose body is AzureBillingRestResponse(false, "Connection to Azure marketplace failed. Details: " + e.getMessage()). The exception message is logged via logError and surfaced to the caller.

Source

Thrown at server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/api/azurebilling/service/DefaultAzureBillingHandler.java:119

    return azureEnvironment.getPlanId()
      .orElseThrow(() -> new IllegalStateException("Azure Plan ID is not configured"));
  }

  @NotNull
  private ResponseEntity<AzureBillingRestResponse> handleAzureBillingRequest(Request request) {
    try (Response response = client.newCall(request).execute()) {
      if (response.isSuccessful()) {
        return ResponseEntity.status(HttpStatus.OK).body(new AzureBillingRestResponse(true, null));
      } else {
        Optional<String> errorMessage = azureBillingResponseHandler.getErrorMessageFromResponse(response);
        String errorMessageValue = errorMessage.orElse(response.message());

        logError(errorMessageValue);
        return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new AzureBillingRestResponse(false, "Call to Azure marketplace failed. Details: " + errorMessageValue));
      }
    } catch (IOException e) {
      logError(e.getMessage());
      return ResponseEntity.status(500).body(new AzureBillingRestResponse(false, "Connection to Azure marketplace failed. Details: " + e.getMessage()));
    }
  }

  private static void logError(String message) {
    LOG.error("Error while billing Azure account: {}", message);
  }

}

View on GitHub (pinned to 184c821202)

Solutions

  1. Check server egress connectivity to the Azure marketplace host (curl/DNS from the SonarQube server) and fix firewall/proxy rules
  2. Retry the billing operation if the failure was transient
  3. Inspect server logs ('Error while billing Azure account: ...') for the underlying IOException message
  4. Verify TLS truststore/proxy configuration if details indicate handshake or unknown-host failures

Example fix

// before: no retry, raw 500
return ResponseEntity.status(500).body(new AzureBillingRestResponse(false, "Connection to Azure marketplace failed. Details: " + e.getMessage()));
// after: bounded retry for transient IO failures
try {
  return doCall();
} catch (IOException e) {
  if (isTransient(e) && attempt < MAX_RETRIES) { backoff(); return doCall(); }
  return ResponseEntity.status(500).body(new AzureBillingRestResponse(false, "Connection to Azure marketplace failed. Details: " + e.getMessage()));
}
Defensive patterns

Strategy: try-catch

Validate before calling

// shell: preflight connectivity to Azure marketplace from the server host
curl -sf --max-time 10 https://marketplaceapi.microsoft.com/api/ >/dev/null \
  || echo "Azure marketplace unreachable from this host"

Try / catch

try {
  ResponseEntity<AzureBillingRestResponse> resp = handler.billAzureAccount(request);
  if (resp.getStatusCode().is5xxServerError()) {
    // network failure to Azure marketplace; check resp.getBody() message and retry later
  }
} catch (RestClientException e) {
  // transport-level failure calling the web API
}

Prevention

When it happens

Trigger: The server cannot reach the Azure marketplace endpoint during billAzureAccount — network outage, DNS resolution failure, TLS handshake problem, connection reset/timeout producing IOException.

Common situations: Server egress firewall blocking the Azure marketplace host; transient network blips; misconfigured proxy; Azure-side incident interrupting connectivity.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/c4ccd231afc430f8. Report an issue: GitHub.