# Azure monitor query py

> Azure monitor query py is an open-source agent skill for cloud and infrastructure. Lets your agent query Azure Log Analytics logs and Azure Monitor metrics from Python. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-monitor-query-py
- **Repository:** https://github.com/microsoft/skills
- **GitHub stars:** 3,223
- **License:** MIT
- **Skill name:** azure-monitor-query-py
- **Collection:** https://github.com/microsoft/skills
- **Categories:** [cloud and infrastructure](https://ai-powered.com/categories/cloud-and-infrastructure), [analytics and data](https://ai-powered.com/categories/analytics-and-data)
- **Listing updated:** 2026-11-18

## About

This skill guides an AI coding agent through the azure-monitor-query Python SDK, covering the LogsQueryClient for Kusto queries against Log Analytics workspaces and the MetricsQueryClient for resource metrics in Azure Monitor. It includes ready-made patterns for single and batch log queries, time range handling, partial result checks, converting results to pandas DataFrames, and listing metric definitions and namespaces.

The skill also sets authentication and lifecycle conventions: it favors DefaultAzureCredential so the same code runs locally and in Azure, suggests constraining the credential chain with an environment variable in production, and asks that clients be wrapped in context managers, with async variants shown alongside sync ones. Reference files cover further capabilities and non-core scenarios.

Using the skill requires the azure-monitor-query package and the environment variables it names, such as a Log Analytics workspace ID for log queries and a resource URI for metric queries. Examples are written in Python and Kusto query language.

## When your agent uses it

> Azure Monitor Query SDK for Python. Use for querying Log Analytics workspaces and Azure Monitor metrics. Triggers: "azure-monitor-query", "LogsQueryClient", "MetricsQueryClient", "Log Analytics", "Kusto queries", "Azure metrics".

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/microsoft/skills/tree/HEAD/.github/plugins/azure-sdk-python/skills/azure-monitor-query-py)
- [License: MIT](https://github.com/microsoft/skills/tree/HEAD/.github/plugins/azure-sdk-python/skills/azure-monitor-query-py)

## Features

- **Log Analytics queries:** Runs Kusto queries against a workspace and reads the returned tables and rows.
- **Batch and async queries:** Covers running several log queries at once and using the aio client variants.
- **Resource metric queries:** Retrieves metrics for an Azure resource with granularity, aggregations and dimension filters.
- **Metric discovery:** Lists metric definitions and namespaces available for a resource.
- **Authentication conventions:** Explains DefaultAzureCredential usage and production credential constraints.
- **Partial result handling:** Shows how to detect partial or failed log query status and report errors.

## Good for

- Query the last hour of application requests and exceptions from a Log Analytics workspace
- Pull CPU and network metrics for an Azure resource over a time window
- Load Kusto query results into a pandas DataFrame for analysis
- Find the slowest requests or top exception types in application logs
- List which metrics an Azure resource exposes

## Install

### Claude Code

Copy the skill folder to `~/.claude/skills/azure-monitor-query-py` to use it in all your projects:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/microsoft/skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/azure-monitor-query-py &&
cp -R "$tmp/.github/plugins/azure-sdk-python/skills/azure-monitor-query-py" ~/.claude/skills/azure-monitor-query-py &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/azure-monitor-query-py` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/azure-monitor-query-py` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/microsoft/skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/azure-monitor-query-py &&
cp -R "$tmp/.github/plugins/azure-sdk-python/skills/azure-monitor-query-py" ~/.agents/skills/azure-monitor-query-py &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/azure-monitor-query-py` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/azure-monitor-query-py` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/microsoft/skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/azure-monitor-query-py &&
cp -R "$tmp/.github/plugins/azure-sdk-python/skills/azure-monitor-query-py" ~/.cursor/skills/azure-monitor-query-py &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/azure-monitor-query-py` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/microsoft/skills.git --path .github/plugins/azure-sdk-python/skills/azure-monitor-query-py
```

Or copy the folder to `~/.gemini/skills/azure-monitor-query-py` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/azure-monitor-query-py`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/microsoft/skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/azure-monitor-query-py &&
cp -R "$tmp/.github/plugins/azure-sdk-python/skills/azure-monitor-query-py" ~/.copilot/skills/azure-monitor-query-py &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/azure-monitor-query-py` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/microsoft/skills.git
```

Then copy `skills/.github/plugins/azure-sdk-python/skills/azure-monitor-query-py` into your agent's skills folder as `azure-monitor-query-py`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill need to run?

It needs the azure-monitor-query package installed, a Log Analytics workspace ID for log queries, and a metrics resource URI for metric queries, both set as environment variables. Azure credentials are obtained through DefaultAzureCredential.

### Which Azure clients does it cover?

It covers LogsQueryClient for Log Analytics workspaces and MetricsQueryClient for Azure Monitor metrics, with async variants for both.

### Does it run any scripts or change my resources?

The skill ships no scripts. It provides code examples and guidance for querying logs and metrics; it does not describe modifying resources.

### How do I install Azure monitor query py in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/azure-monitor-query-py to use it in all your projects, or to .claude/skills/azure-monitor-query-py in one project.

### Does Azure monitor query py run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Azure monitor query py?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Azure monitor query py?

The closest alternatives to Azure monitor query py are Azure monitor query java, Azure kusto graph, Cost analysis, Azure kusto irql graph and Azure monitor ingestion py.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Azure monitor query java](https://ai-powered.com/skills/azure-monitor-query-java): Azure monitor query java is an open-source agent skill for cloud and infrastructure.
- [Azure kusto graph](https://ai-powered.com/skills/azure-kusto-graph): Azure kusto graph is an open-source agent skill for cloud and infrastructure.
- [Cost analysis](https://ai-powered.com/skills/cost-analysis): Cost analysis is an open-source agent skill for cloud and infrastructure.
- [Azure kusto irql graph](https://ai-powered.com/skills/azure-kusto-irql-graph): Azure kusto irql graph is an open-source agent skill for cloud and infrastructure.
- [Azure monitor ingestion py](https://ai-powered.com/skills/azure-monitor-ingestion-py): Azure monitor ingestion py is an open-source agent skill for cloud and infrastructure.
- [Connect observability](https://ai-powered.com/skills/connect-observability): Connect observability is an open-source agent skill for cloud and infrastructure.
- [Azure kusto irql](https://ai-powered.com/skills/azure-kusto-irql): Azure kusto irql is an open-source agent skill for cloud and infrastructure.
- [Azure kusto](https://ai-powered.com/skills/azure-kusto): Azure kusto is an open-source agent skill for cloud and infrastructure.

---
Source: https://ai-powered.com/skills/azure-monitor-query-py
