azure-monitor-query
Microsoft Corporation Azure Monitor Query Client Library for Python
What it is and what it does
Azure Monitor Query is a Python client library for querying logs stored in Azure Monitor's Logs data platform. It provides both synchronous and asynchronous interfaces to execute read-only Kusto Query Language queries against Log Analytics workspaces or individual Azure resources. The library handles authentication via Azure credentials (typically DefaultAzureCredential), manages timespan parameters, and returns structured query results as tables with rows and columns.
The package is designed for developers who need to programmatically access Azure monitoring and diagnostic data. It consolidates log and performance data from multiple sources—platform logs, virtual machine agents, and application telemetry—into queryable results. As of version 2.0.0, metrics querying has been moved to separate packages (azure-monitor-querymetrics or azure-mgmt-monitor), so this library focuses exclusively on logs queries.
Use it for:
- Query Azure Log Analytics workspaces to retrieve application logs, performance metrics, and diagnostic data for analysis or reporting.
- Build monitoring dashboards or alerting systems that pull data directly from Azure Monitor logs programmatically.
- Perform resource-centric log queries on individual Azure resources without needing a dedicated Log Analytics workspace.
- Implement batch log queries to retrieve multiple datasets in a single operation for bulk data export or analysis.
- Integrate Azure monitoring data into Python-based data pipelines or ETL workflows using async clients for non-blocking I/O.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Executes read-only queries against Azure Monitor's Logs data platform using the Kusto Query Language, supporting both synchronous and asynchronous clients.
Yes. The package is actively maintained, has low install friction, carries a permissive MIT license, and is production-stable. Install it if you need to query Azure Monitor logs from Python. Be aware that metrics querying is no longer included—use azure-monitor-querymetrics or azure-mgmt-monitor for that instead.
Install
azure-monitor-query on PyPI
pip
pip install azure-monitor-queryuv
uv add azure-monitor-querypoetry
poetry add azure-monitor-queryInstalling azure-monitor-query
Before you install
Low install friction with three lightweight runtime dependencies (isodate, azure-core, typing-extensions). Actively maintained with recent releases; last commit 2026-08-14 and status marked active.
License in practice
MIT License permits commercial use, modification, and distribution with minimal restrictions—suitable for most projects.
Quickstart
pip install azure-monitor-query
from azure.identity import DefaultAzureCredential
from azure.monitor.query import LogsQueryClient
credential = DefaultAzureCredential()
client = LogsQueryClient(credential)
response = client.query_workspace(workspace_id='<id>', query='AzureActivity | take 5')
Requires Python 3.9 or later; Azure credentials and a Log Analytics workspace or Azure resource are needed to execute queries.
Verify before relying
- Whether the package handles large result sets efficiently or has row/response size limits beyond those mentioned in the service documentation.
- Performance characteristics when querying across multiple workspaces simultaneously.
- Whether async clients require additional setup beyond installing aiohttp.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — isodate, azure-core, typing-extensions |
| Maintenance | actively maintained — 380 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 10,626,279/month — #1,442 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: azure_monitor_query-2.0.0-py3-none-any.whl
Keywords: azure, azure sdk
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
azure-monitor-ingestionSends custom logs and structured data to Azure…
permissive · top 5,000 on PyPI
azure-monitor-querymetricsQuery and retrieve numerical metrics data from…
permissive · top 15,000 on PyPI
azure-loganalyticsProvides a Python client for querying Azure Log…
permissive · top 5,000 on PyPI
azure-kusto-dataQuery and interact with Microsoft Azure Kusto…
permissive · top 5,000 on PyPI
azure-mgmt-monitorProvides programmatic access to Azure Monitor…
permissive · top 5,000 on PyPI
azure-applicationinsightsProvides a Python client library for querying…
permissive · top 5,000 on PyPI
logging-azure-restProvides a Python logging handler that…
permissive · top 5,000 on PyPI
azure-mgmt-kustoManages Azure Kusto clusters, databases, and…
permissive · top 15,000 on PyPI
azure-data-tablesProvides a Python client for reading, writing,…
permissive · top 5,000 on PyPI
azure-mgmt-resource-subscriptionsManages Azure subscriptions and related…
permissive · top 15,000 on PyPI