Application Insights Java Agent: Which Certificates to add to truststore?

Viewed 106

I'm getting the following error when starting my spring-boot application with the azure application-insights agent:

*************************
ApplicationInsights Java Agent failed to send telemetry data.
*************************
 
Description:
Unable to find valid certification path to requested target.
 
Action:
Please import the SSL certificate from https://westeurope.livediagnostics.monitor.azure.com/QuickPulseService.svc, into your custom java key store located at:
/truststore/truststore.jks
Learn more about importing the certificate here: https://go.microsoft.com/fwlink/?linkid=2151450

This error only appears sometimes, sometimes it works. It seems that different Azure Servers use different chains (+ root CA's).

My truststore contains the following Certs:

  • Baltimore CyberTrust Root
  • Microsoft RSA TLS CA 02
  • Cert for live.applicationinsights.azure.com
  • cert for in.applicationinsights.azure.com

I found the following List of all Azure Certificates.

Which Certificates from this list do I need to add to the truststore for the error to go away permanently?

EDIT: I've now added all the root certs from the page to my truststore, but I'm still getting the same error message. I do however see data in Azure Insights...

1 Answers

Try using application insight agent by which there is no need of modifying your spring boot application you only need to provide the correct environment variables

Here is the sample code for setting environment variables

APPLICATIONINSIGHTS_CONNECTION_STRING = <Copy connection string from Application Insights Resource Overview>

Else you can even set the environment variables by adding them in connecting string using applicationsettings.json file and below is the sample code for that

{
  "connectionString": "Copy connection string from Application Insights Resource Overview"
}

For the complete information regarding adding environment variables you can refer the document suggested by @Paizo.

Related