Picking up from Part I, this post shows how to obtain the Elastic APM Server URL and Secret token, add the OTEL Elastic sidecar, and validate telemetry in Kibana.
Most steps are identical to the Azure Monitor walkthrough (create PHP app, add OTEL libraries, deploy, map OTEL_PHP_AUTOLOAD_ENABLED, keep the same startup command, and point your app to the sidecar at http://127.0.0.1:4318).
The only differences are - get your Elastic APM Server URL and Secret token, choose the OpenTelemetry – Elastic APM extension, and set Elastic-specific app settings.
You can use the sample code (based on your language stack) from here - https://github.com/Azure-Samples/sidecar-samples/tree/main/otel-sidecar
1) Get the Elastic APM Server URL
In Kibana go to:
Observability → Data management → Fleet → Agent policies → Elastic Cloud agent policy → Elastic APM.
Copy the URL shown in the “Server configuration” section.
2) Get or generate the Secret token
Still in the Elastic APM integration page, scroll to Agent authorization.
Use the existing Secret token or generate one if needed.
3) Add the sidecar extension (Web App → Deployment Center)
Deployment Center → Containers (new) → Add → Sidecar Extension → choose
Observability: OpenTelemetry – Elastic APM.
Provide the APM Server URL and Secret token you copied above, then Save.
4) View Elastic-specific app settings (main app)
These are added by default Environment variables → Application settings:
ELASTIC_APM_ENDPOINT = https://<your-elastic-apm-server-url>
ELASTIC_APM_SECRET_TOKEN = <your-secret-token>
OTEL_EXPORTER = elastic
OTEL_EXPORTER_OTLP_ENDPOINT = http://127.0.0.1:4318
OTEL_SERVICE_NAME = <your-app-name>
(Keep using :4318 for OTLP/HTTP to the sidecar. Your Elastic URL is the remote APM server the sidecar forwards to.)
Everything else—code, Composer deps, autoload flag mapping, and startup command—remains the same as the Azure Monitor section.
5) Validate telemetry in Kibana
- In Kibana, open Observability → APM → Services.
- Find your service name (the value of OTEL_SERVICE_NAME).
- Open the service to view transactions, traces, and dependencies.
You can also check logs/fields in Discover:
That’s it—your PHP app is instrumented with OTEL, sends signals to the local sidecar, and the sidecar ships them to Elastic APM.
Sample repo (code & containers)
We’ve published a repo with working samples for PHP, Node.js, Python, and .NET showing both code-based and container-based setups using the OTEL sidecar extensions. Use it as your starting point: sidecar-samples/otel-sidecar at main · Azure-Samples/sidecar-samples
In Part III, we’ll share a language cheat-sheet, a copy/paste app-settings reference, and troubleshooting tips for common issues.