azure-monitor-opentelemetry-py
Azure Monitor OpenTelemetry distro for Python: one-line Application Insights setup with auto-instrumentation.
- Kind
- Skill
- Works with
- Claude Code
- Languages
- Python
- Source
- microsoft/skills @ 2130750147de
- Path
- .github/plugins/azure-sdk-python/skills/azure-monitor-opentelemetry-py/SKILL.md
- License
- MIT
- Jobs
- Implementation
InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
# Azure Monitor OpenTelemetry Distro for Python One-line setup for Application Insights with OpenTelemetry auto-instrumentation. ## Installation ```bash pip install azure-monitor-opentelemetry ``` ## Environment Variables ```bash APPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=xxx;IngestionEndpoint=https://xxx.in.applicationinsights.azure.com/ # Required for all auth methods AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in production ``` ## Authentication & Lifecycle > **🔑 Two rules apply to every code sample below:** > > 1. **Prefer `DefaultAzureCredential` for ingestion auth when supported.** `APPLICATIONINSIGHTS_CONNECTION_STRING` identifies the target Application Insights resource, and `credential=DefaultAzureCredential(...)` provides Microsoft Entra authentication. > - Local dev: `DefaultAzureCredential` works as-is. > - Production: set `AZURE_TOKEN_CREDENTIALS=prod` (or `AZURE_TOKEN_CREDENTIALS=<specific_credential>`) to constrain the credential chain to production-safe credentials. …