# Query Azure Monitor Data with Python

Azure Monitor queries require correct clients, credentials, resource identifiers, time ranges, and response handling. This skill provides focused Python and Kusto patterns for logs and metrics.

## Install

```bash
npx skillstore add sickn33/azure-monitor-query-py
```

## Metadata

- Status: approved
- Slug: sickn33-azure-monitor-query-py
- Skillstore revision: r2
- Version status: missing
- Tree hash: 1ec3187da37a2c9512fd92a554020a229460bcaa0d353fdf31e24e6347e4aaf5
- Author: sickn33
- GitHub username: sickn33
- License: MIT
- Repository: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-monitor-query-py
- Ref: f9e2c34b4f19c7f3e6b0a1e93227b5f77cc12526
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, env\_access
- Quality score: 78
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/sickn33-azure-monitor-query-py
- Manifest: https://skillstore.pages.dev/api/skills/sickn33-azure-monitor-query-py/manifest

## Capabilities

- Shows package installation and authentication with DefaultAzureCredential.
- Builds synchronous log workspace queries with relative or explicit time ranges.
- Converts log query tables into pandas DataFrames.
- Runs batch queries and distinguishes partial results from failures.
- Queries resource metrics with aggregation, granularity, and dimension filters.
- Demonstrates asynchronous clients and common Kusto queries for requests and exceptions.

## Use Cases

- Investigate application failures: Build Log Analytics queries that summarize requests, exceptions, status codes, and slow operations over a selected period.
- Review resource performance: Query Azure resource metrics with selected aggregations, time granularity, and dimension filters.
- Prepare monitoring data: Convert query results into DataFrames for analysis, reporting, and comparison across time ranges.

## Prompt Templates

### Create a basic log query

```
Show a Python example that queries {table} in my workspace for the last {hours} hours using DefaultAzureCredential.
```

### Query a resource metric

```
Create a Python metrics query for {metric_names} on {resource_uri} with {granularity} granularity and {aggregation} aggregation.
```

### Build resilient batch queries

```
Design batch log queries for {tables} over {time_range}. Include partial-result and failure handling, then summarize each returned table.
```

### Design an asynchronous analysis

```
Design an asynchronous Python workflow for {workspace_ids} using {kusto_query}. Handle partial results, close clients, and prepare tables for {analysis_goal}.
```

## Limitations

- Provides examples and guidance but does not execute queries or validate Azure configuration.
- Requires existing Azure access, permissions, workspace identifiers, and resource URIs.
- Some snippets require surrounding imports and previously defined variables.
- Does not cover alerting, data ingestion, dashboards, or Azure resource provisioning.

## Best Practices

- Use explicit time ranges and suitable granularity to control query volume.
- Handle partial results and failures before processing returned tables.
- Close asynchronous clients and credentials after each completed workflow.

## Anti Patterns

- Do not assume example workspace identifiers or resource URIs match your environment.
- Do not request broad time ranges when a focused interval answers the question.
- Do not process response tables without checking status and table availability.

## Security Audit

- Audited at: 2026-07-23T22:08:59.424\+00:00
- Summary: The 31 external-command alerts are false positives caused by Markdown fences and inline code formatting; none performs Ruby or shell backtick execution. The two environment reads retrieve documented Azure resource identifiers for intended SDK calls, with no credential disclosure or unrelated transmission. No prompt injection or other semantic security issue was found.

## Stats

- Views: 141
- Downloads: 10
- Favorites: 0
- Popularity score: 0
