azure-monitor-query-py

Query Azure Monitor logs and metrics from Python.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/davidrrowley/CortexYouV3 --skill azure-monitor-query-py-davidrrowley
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: azure-monitor-query-py
Source: https://github.com/davidrrowley/CortexYouV3/tree/main/.agents/skills/azure-monitor-query-py
Command: npx skills add https://github.com/davidrrowley/CortexYouV3 --skill azure-monitor-query-py-davidrrowley

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provides a concise, code-first guide to query Azure Monitor logs and resource metrics from Python, removing friction when retrieving telemetry for troubleshooting, monitoring, and reporting. It standardizes authentication, time range handling, partial-result handling, and offers examples for synchronous and asynchronous usage so developers can reliably extract insights.

Core Features & Use Cases

  • Logs Queries: Run Log Analytics (Kusto) queries against a workspace, handle partial results, and run batch queries for parallel retrieval.
  • Metrics Queries: Query resource metrics with aggregations, granularity, and dimension filters to power dashboards or alerts.
  • Data Integration: Convert query tables into pandas DataFrame for analysis, or iterate tables/rows for custom processing.
  • Use Case: Pull the last hour of AppRequests to investigate error spikes, compute CPU average over a time window for autoscaling analysis, or batch multiple queries to gather telemetry for an incident report.

Quick Start

Run a LogsQueryClient query for the last hour of AppRequests using DefaultAzureCredential and convert the first result table to a pandas DataFrame.

Frequently Asked Questions about azure-monitor-query-py

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query Azure Monitor logs from Python?

You can query Azure Monitor logs from Python by using a LogsQueryClient to run Kusto queries against a Log Analytics workspace. This Skill provides code-first examples that standardize authentication and time range handling for retrieving telemetry.

Can I convert Azure Monitor query results to a pandas DataFrame?

Yes, you can convert Azure Monitor query results to a pandas DataFrame. The Skill enables optional conversion of query tables into DataFrames to facilitate data analysis, or you can iterate tables and rows for custom processing.

Does this approach support asynchronous Azure Monitor queries?

Yes, this approach supports asynchronous Azure Monitor queries. The Skill includes examples for both synchronous and asynchronous clients, allowing you to retrieve logs and resource metrics concurrently for parallel telemetry gathering.

What is the best way to run batch Kusto queries against Log Analytics?

The best way to run batch Kusto queries against Log Analytics is using the batch query support provided by this Skill. It allows parallel retrieval of telemetry from a Log Analytics workspace, which is useful for gathering data for incident reports.

How do I handle partial results when querying Log Analytics workspaces?

You handle partial results when querying Log Analytics workspaces by using the partial result handling logic included in this Skill. This ensures you can reliably extract insights even when the query does not complete fully.

Do I need azure-identity to query Azure resource metrics?

Yes, you need azure-identity to query Azure resource metrics. The Skill requires both azure-monitor-query and azure-identity libraries to standardize authentication using DefaultAzureCredential for monitoring and incident investigation.