> ## Documentation Index
> Fetch the complete documentation index at: https://docs.honeycomb.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Collect Telemetry from Azure

> Send Azure telemetry to Honeycomb using an OpenTelemetry Collector.

Deploy an OpenTelemetry (OTel) Collector to ingest telemetry from Azure services and send it to Honeycomb.
Analyzing your Azure telemetry with Honeycomb lets you answer questions like:

* Which App Services are experiencing the highest latency?
* How are my Function Apps performing across different regions?
* What is the error rate for my Service Bus queues?
* Are there any performance bottlenecks in my Cosmos DB operations?

## Before you begin

Before you begin, make sure you have:

* An Azure subscription with the services you want to monitor
* Access to configure Azure Monitor and Event Hub
* A [Honeycomb Ingest API Key](/configure/environments/manage-api-keys/#create-api-key)

## Choosing a collector distribution

Your first decision is which collector distribution to use:

* **[OpenTelemetry Collector Contrib](https://github.com/open-telemetry/opentelemetry-collector-releases/releases):** The community-maintained distribution that includes Azure [receivers](https://opentelemetry.io/docs/collector/components/receiver/).
  This is the recommended starting point if you are already using OpenTelemetry across your stack or want a single collector for multiple environments.
* **[Custom collector](https://opentelemetry.io/docs/collector/extend/ocb/):** Build your own binary with only the components you need.
  Include only the components that match the Azure services you want to monitor:

  * [Azure Blob Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/azureblobreceiver)
  * [Azure Event Hub Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/azureeventhubreceiver)
  * [Azure Monitor Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/azuremonitorreceiver)
  * [Azure Encoding Extension](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/encoding/azureencodingextension)
  * [Azure Auth Extension](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/azureauthextension)

Use the following `builder-config.yaml` to build a custom collector with the Azure components:

```yaml theme={}
extensions:
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/azureauthextension v0.149.0
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding/azureencodingextension v0.149.0

receivers:
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureblobreceiver v0.149.0
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver v0.149.0
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azuremonitorreceiver v0.149.0
```

## Collecting traces, logs, and metrics from an Azure Event Hub

Azure Event Hub acts as a central hub for telemetry from across your Azure environment.
[Configure Azure Monitor](https://learn.microsoft.com/en-us/azure/azure-monitor/platform/diagnostic-settings?tabs=portal) to route diagnostic logs and metrics to an Event Hub, then configure the [Azure Event Hub Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/azureeventhubreceiver) to collect that telemetry and forward it to Honeycomb.
To learn about this approach, visit [Stream Azure monitoring data to an event hub and external partner](https://learn.microsoft.com/en-us/azure/azure-monitor/platform/stream-monitoring-data-event-hubs).

This example configuration uses the [Azure Authenticator Extension](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/azureauthextension) to authenticate using a service principal:

```yaml theme={}
receivers:
  azure_event_hub:
    event_hub:
      name: hubName
      namespace: namespace.servicebus.windows.net
    auth: azure_auth

extensions:
  azure_auth:
    service_principal:
      client_id: ${env:AZURE_CLIENT_ID}
      client_secret: ${env:AZURE_CLIENT_SECRET}
      tenant_id: ${env:AZURE_TENANT_ID}
```

## Collecting resource metrics from the Azure Monitor API

The Azure Monitor API provides resource-level metrics for your Azure services, such as CPU usage, memory consumption, and request counts.
Use the [Azure Monitor Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/azuremonitorreceiver) to pull these metrics from the Azure Monitor API on a schedule and forward them to Honeycomb.

This example configuration uses [Azure Authenticator Extension](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/azureauthextension) to authenticate:

```yaml theme={}
receivers:
  azure_monitor:
    subscription_ids: ["${subscription_id}"]
    auth:
      authenticator: azure_auth
    resource_groups:
      - ${resource_groups}
    services:
      - Microsoft.EventHub/namespaces
      - Microsoft.AAD/DomainServices
    metrics:
      "microsoft.eventhub/namespaces": # fetch only the metrics listed below:
        IncomingMessages: [total]     # metric IncomingMessages with aggregation "Total"
        NamespaceCpuUsage: [*]        # metric NamespaceCpuUsage with all known aggregations
        ActiveConnections: []         # metric ActiveConnections with all known aggregations (same as [*])

extensions:
  azure_auth:
    managed_identity:
      client_id: ${client_id}
```

To explore other authentication methods, visit the [Azure Monitor Receiver README](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/azuremonitorreceiver#example-configurations).

## Exporting telemetry to Honeycomb

Once your receivers are configured, add an OTLP exporter to send your Azure telemetry to Honeycomb.
Use the endpoint that matches the region where your Honeycomb data is stored.

Configure an OTLP exporter with your [Honeycomb Ingest API Key](/configure/environments/manage-api-keys/#create-api-key) as a header:

```yaml theme={}
exporters:
  otlp/honeycomb:
    endpoint: "api.honeycomb.io:443" # US instance
    #endpoint: "api.eu1.honeycomb.io:443" # EU instance
    headers:
      "x-honeycomb-team": "YOUR_API_KEY"
```

By default, Honeycomb routes telemetry to datasets based on the service name in your data.
If you want to send specific signal types, such as metrics, to a dedicated dataset, add a second exporter with the `x-honeycomb-dataset` header:

```yaml theme={}
exporters:
  otlp/honeycomb:
    endpoint: "api.honeycomb.io:443" # US instance
    #endpoint: "api.eu1.honeycomb.io:443" # EU instance
    headers:
      "x-honeycomb-team": "YOUR_API_KEY"
  otlp/honeycomb_metrics:
    endpoint: "api.honeycomb.io:443" # US instance
    #endpoint: "api.eu1.honeycomb.io:443" # EU instance
    headers:
      "x-honeycomb-team": "YOUR_API_KEY"
      "x-honeycomb-dataset": "YOUR_METRICS_DATASET"
```

## Getting help

To ask questions and learn more, join our [Pollinators Community Slack](/troubleshoot/community/#join-pollinators-community-slack).
