azure-monitor-query-py
Skill by microsoft
Azure Monitor Query SDK for Python. It queries Log Analytics workspaces with Kusto queries and reads Azure Monitor metrics. It is for Python developers who need to pull Azure logs or metrics into their code.
Install azure-monitor-query-py
Built from the published package, never by AI.
git clone --depth 1 https://github.com/microsoft/skills /tmp/skills && mkdir -p ~/.claude/skills && cp -r /tmp/skills/.github/plugins/azure-sdk-python/skills/azure-monitor-query-py ~/.claude/skills/azure-monitor-query-pyRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/microsoft/skills /tmp/skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/skills/.github/plugins/azure-sdk-python/skills/azure-monitor-query-py ~/.gemini/antigravity-cli/skills/azure-monitor-query-pyAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install azure-monitor-query-py in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill is a guide for the azure-monitor-query Python package. It shows how to query Log Analytics workspaces with LogsQueryClient and Azure Monitor metrics with MetricsQueryClient. The examples cover basic and time-range log queries, batch queries, partial result handling, and conversion of results to a pandas DataFrame.
For metrics, the skill covers resource metric queries, aggregation types, dimension filters, and listing metric definitions and namespaces. It also shows async versions of both clients and includes common Kusto queries. The guide recommends DefaultAzureCredential and context managers for clients. It is aimed at Python developers who work with Azure monitoring data.
Written from the project's SKILL.md and checked against it.
What it can do
- Log Analytics queriesRuns Kusto queries against a Log Analytics workspace with LogsQueryClient.
- Batch log queriesSends several log queries in one call using LogsBatchQuery.
- Metric queriesReads Azure Monitor metrics for a resource with MetricsQueryClient.
- Metric aggregationsRequests average, maximum, minimum and count values for metrics.
- Dimension filtersNarrows metric results with a filter such as ApiName eq 'GetBlob'.
- Metric discoveryLists metric definitions and metric namespaces for a resource.
- Async clientsProvides async versions of the logs and metrics clients.
- DataFrame conversionTurns log query tables into a pandas DataFrame for analysis.
What you need
- Python
- pip install of azure-monitor-query
- Azure credentials usable with DefaultAzureCredential
- Log Analytics workspace ID for log queries
- Azure resource URI for metric queries
Try asking
- Query my Log Analytics workspace for failed requests in the last hour
- Get the CPU and network metrics for my Azure resource over 24 hours
- Write a Python script that lists metric namespaces for a resource URI
Good to know
- Sync and async clients should not be mixed in the same call path.
- Production code should use DefaultAzureCredential with AZURE_TOKEN_CREDENTIALS set to prod or a specific credential.
- Large queries may return partial results, which the code must check.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .github/plugins/azure-sdk-python/skills/azure-monitor-query-py/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md8 KB -
references/capabilities.md1 KB -
references/non-hero-scenarios.md389 B
Alternatives to azure-monitor-query-py
All alternatives →Runs the full Next.js deployment test suite for an internal vercel/next.js pull request. It validates the commit's preview package, then dispatches the test_e2e_deploy_release.yml workflow. Meant for maintainers who explicitly ask for the entire suite.
Instruments Python AI applications with DeepEval's native tracing so their execution appears span by span in Confident AI's Observatory. It is for developers building LLM apps, agents, RAG pipelines and chatbots.
Manages Azure Container Registry through the az acr Azure CLI command group. It covers registries, images, cloud builds, ACR Tasks, tokens, geo-replication and networking. Built for developers and operators who work with ACR in Azure.
Opens, runs, and shows apps on a temporary Crabbox machine, including native desktops and web previews. It is for OpenClaw users who want an app running and visible in their chat side panel.
Runs batch and HPC workloads on GKE using job queues and parallel processing. Aimed at teams running batch pipelines, HPC simulations, or ML training jobs on Google Kubernetes Engine.
Answers questions about GKE cluster and workload costs using BigQuery billing exports and live cluster metrics. Built for platform engineers and cloud teams who need to analyze and diagnose GKE spend.
Compare with deploy-release-test, deepeval-tracing or azure-container-registry-cli
azure-monitor-query-py: common questions
Which environment variables does this skill need?
It uses AZURE_LOG_ANALYTICS_WORKSPACE_ID for log queries and AZURE_METRICS_RESOURCE_URI for metric queries. AZURE_TOKEN_CREDENTIALS is needed only when DefaultAzureCredential is used in production.
Does it support async code?
Yes. The source shows async clients imported from azure.monitor.query.aio, used with async DefaultAzureCredential from azure.identity.aio.
Which authentication method does the guide recommend?
The guide recommends DefaultAzureCredential because it works locally and in Azure without code changes. It advises avoiding connection strings and account keys.
How do I install azure-monitor-query-py?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is azure-monitor-query-py free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is azure-monitor-query-py safe to use?
It scores 92 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to azure-monitor-query-py?
Similar skills: deploy-release-test, deepeval-tracing, azure-container-registry-cli, crabbox-apps.
