Azure Private link APM agent connectivity issue

Hello, I am using a private link with our Elastic cloud instance on azure running on version 7.14. I am trying to add an APM Java agent to one of our servers. The Example configuration file given in Kibana includes the public address of the deployment.

Using this address works, however when using the private link address instead I receive an error 401.

Which address should be used in the "-Delastic.apm.server_urls=" field.

(Note: The private link has been created after the deployment which makes it impossible to use it as default for this deployment

Also, the private link is already used for a different type of data ingestion into the same cloud deployment without issue.)

I think I'm missing something - if the public link works but the private one doesn't, is there some reason why you don't use the public one?

It is required by my company to use the private link.

The URL for the address field is whatever gets you a valid result if you curl, eg

When using secret token

curl --request GET --url https://your_domain:443/ --header 'Authorization: Bearer <secret_token>'

When using API key

curl --request GET --url https://your_domain:443/ --header 'Authorization: ApiKey <api_key>'

The output of the curl should be something like

{
  "build_date": "..."
  ...
}

though note that if the authorization is wrong, you'll still get a 200 response, but with no body - which may still be enough for you to verify which URL to use for the agent

Thank you I will give this a try.