Azure Data Explorer (Kusto) Query & Analytics

by microsoft· MIT license· ★ 1,599 on GitHub

Query and analyze data in Azure Data Explorer (Kusto/ADX) using KQL for log analytics, telemetry, and time series analysis. WHEN: KQL queries, Kusto database queries, Azure Data Explorer, ADX clusters, log analytics, time series data,…

SkillFreeInfrastructure & ops

Overview

Execute KQL queries and manage Azure Data Explorer resources for fast, scalable big data analytics on log, telemetry, and time series data.

Install

Claude Codenpx skills add microsoft/azure-skills --skill azure-kusto -g -a claude-code
Claude Code (degit)npx degit microsoft/azure-skills/skills/azure-kusto#main ~/.claude/skills/azure-kusto
Claude.ai / desktopZip the folder and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md; everything else is plain files.
Any agent via Agent Alley MCPConnect once, then ask: “use azure-kusto”.

Files included

  • SKILL.md8.4 KB
Read SKILL.md here
microsoft/main1 file shown
SKILL.md
Show the full text215 lines

Azure Data Explorer (Kusto) Query & Analytics

Execute KQL queries and manage Azure Data Explorer resources for fast, scalable big data analytics on log, telemetry, and time series data.

Overview

This skill enables querying and managing Azure Data Explorer (Kusto), a fast and highly scalable data exploration service optimized for log and telemetry data. Azure Data Explorer provides sub-second query performance on billions of records using the Kusto Query Language (KQL).

Key capabilities:

  • Query Execution: Run KQL queries against massive datasets
  • Schema Exploration: Discover tables, columns, and data types
  • Resource Management: List clusters and databases
  • Analytics: Aggregations, time series, anomaly detection, machine learning

Core Workflow

  1. Discover Resources: List available clusters and databases in subscription. If the target table's location is unknown and multiple candidate clusters, databases, or Log Analytics workspaces exist, batch the search (see Pattern 6) and only report "not found" after all candidates are checked.
  2. Explore Schema: Retrieve table structures to understand data model
  3. Query Data: Execute KQL queries for analysis, filtering, aggregation
  4. Analyze Results: Process query output for insights and reporting

Query Patterns

Pattern 1: Basic Data Retrieval

Fetch recent records from a table with simple filtering.

Example KQL:

Events
| where Timestamp > ago(1h)
| take 100

Use for: Quick data inspection, recent event retrieval

Pattern 2: Aggregation Analysis

Summarize data by dimensions for insights and reporting.

Example KQL:

Events
| summarize count() by EventType, bin(Timestamp, 1h)
| order by count_ desc

Use for: Event counting, distribution analysis, top-N queries

Pattern 3: Time Series Analytics

Analyze data over time windows for trends and patterns.

Example KQL:

Telemetry
| where Timestamp > ago(24h)
| summarize avg(ResponseTime), percentiles(ResponseTime, 50, 95, 99) by bin(Timestamp, 5m)
| render timechart

Use for: Performance monitoring, trend analysis, anomaly detection

Pattern 4: Join and Correlation

Combine multiple tables for cross-dataset analysis.

Example KQL:

Events
| where EventType == "Error"
| join kind=inner (
    Logs
    | where Severity == "Critical"
) on CorrelationId
| project Timestamp, EventType, LogMessage, Severity

Use for: Root cause analysis, correlated event tracking

Pattern 5: Schema Discovery

Explore table structure before querying.

Tools: kusto_table_schema_get

Use for: Understanding data model, query planning

Pattern 6: Batch Search Across Candidate Sources

When a table's location is unknown and there are several candidate clusters, databases, or workspaces, batch read-only metadata discovery instead of querying candidates one at a time. List tables in each candidate database or workspace and match the exact table name before querying data.

After confirming which sources contain the table, query those sources together when needed:

union workspace('ws1').Requests, workspace('ws2').Requests
| take 1

Use for: Locating a table among many candidate resources without confusing an empty result with a missing table

Key Data Fields

When executing queries, common field patterns:

  • Timestamp: Time of event (datetime) - use ago(), between(), bin() for time filtering
  • EventType/Category: Classification field for grouping
  • CorrelationId/SessionId: For tracing related events
  • Severity/Level: For filtering by importance
  • Dimensions: Custom properties for grouping and filtering

Result Format

Query results include:

  • Columns: Field names and data types
  • Rows: Data records matching query
  • Statistics: Row count, execution time, resource utilization
  • Visualization: Chart rendering hints (timechart, barchart, etc.)

KQL Best Practices

🔵 Query Patterns:

  • Use summarize for aggregations instead of count() alone
  • Use bin() for time bucketing in time series
  • Use project to select only needed columns
  • Use extend to add calculated fields

🟡 Common Functions:

  • ago(timespan): Relative time (ago(1h), ago(7d))
  • between(start .. end): Range filtering
  • startswith(), contains(), matches regex: String filtering
  • parse, extract: Extract values from strings
  • percentiles(), avg(), sum(), max(), min(): Aggregations

Best Practices

  • Filter early with time range filters to optimize query performance and use indexed columns first
  • Use take or limit for exploratory queries to avoid large result sets
  • Leverage summarize for aggregations instead of client-side processing
  • Store frequently-used queries as functions in the database
  • Use materialized views for repeated aggregations
  • Monitor query performance and resource consumption
  • Apply data retention policies to manage storage costs
  • Use streaming ingestion for real-time analytics (< 1 second latency)
  • Integrate with Azure Monitor for operational insights

MCP Tools Used

Tool Purpose
kusto_cluster_list List all Azure Data Explorer clusters in a subscription
kusto_database_list List all databases in a specific Kusto cluster
kusto_query Execute KQL queries against a Kusto database
kusto_table_schema_get Retrieve schema information for a specific table

Required Parameters:

  • subscription: Azure subscription ID or display name
  • cluster: Kusto cluster name (e.g., "mycluster")
  • database: Database name
  • query: KQL query string (for query operations)
  • table: Table name (for schema operations)

Optional Parameters:

  • resource-group: Resource group name (for listing operations)
  • tenant: Azure AD tenant ID

Fallback Strategy: Azure CLI Commands

If Azure MCP Kusto tools fail, timeout, or are unavailable, use Azure CLI commands as fallback.

CLI Command Reference
Operation Azure CLI Command
List clusters az kusto cluster list --resource-group <rg-name>
List databases az kusto database list --cluster-name <cluster> --resource-group <rg-name>
Show cluster az kusto cluster show --name <cluster> --resource-group <rg-name>
Show database az kusto database show --cluster-name <cluster> --database-name <db> --resource-group <rg-name>
KQL Query via Azure CLI

For queries, use the Kusto REST API or direct cluster URL:

az rest --method post \
  --url "https://<cluster>.<region>.kusto.windows.net/v1/rest/query" \
  --body "{ \"db\": \"<database>\", \"csl\": \"<kql-query>\" }"
When to Fallback

Switch to Azure CLI when:

  • MCP tool returns timeout error (queries > 60 seconds)
  • MCP tool returns "service unavailable" or connection errors
  • Authentication failures with MCP tools
  • Empty response when database is known to have data

Common Issues

  • Access Denied: Verify database permissions (Viewer role minimum for queries)
  • Query Timeout: Optimize query with time filters, reduce result set, or increase timeout
  • Syntax Error: Validate KQL syntax - common issues: missing pipes, incorrect operators
  • Empty Results: Check time range filters (may be too restrictive), verify table name
  • Table Location Unknown: Use Pattern 6 to batch-search all candidate sources before concluding the data does not exist
  • Cluster Not Found: Check cluster name format (exclude ".kusto.windows.net" suffix)
  • High CPU Usage: Query too broad - add filters, reduce time range, limit aggregations
  • Ingestion Lag: Streaming data may have 1-30 second delay depending on ingestion method

Use Cases

  • Log Analytics: Application logs, system logs, audit logs
  • IoT Analytics: Sensor data, device telemetry, real-time monitoring
  • Security Analytics: SIEM data, threat detection, security event correlation
  • APM: Application performance metrics, user behavior, error tracking
  • Business Intelligence: Clickstream analysis, user analytics, operational KPIs
1---
2name: azure-kusto
3description: "Query and analyze data in Azure Data Explorer (Kusto/ADX) using KQL for log analytics, telemetry, and time series analysis. WHEN: KQL queries, Kusto database queries, Azure Data Explorer, ADX clusters, log analytics, time series data, IoT telemetry, anomaly detection."
4license: MIT
5metadata:
6 author: Microsoft
7 version: "1.2.2"
8---
9 
10# Azure Data Explorer (Kusto) Query & Analytics
11 
12Execute KQL queries and manage Azure Data Explorer resources for fast, scalable big data analytics on log, telemetry, and time series data.
13 
14## Overview
15 
16This skill enables querying and managing Azure Data Explorer (Kusto), a fast and highly scalable data exploration service optimized for log and telemetry data. Azure Data Explorer provides sub-second query performance on billions of records using the Kusto Query Language (KQL).
17 
18Key capabilities:
19- **Query Execution**: Run KQL queries against massive datasets
20- **Schema Exploration**: Discover tables, columns, and data types
21- **Resource Management**: List clusters and databases
22- **Analytics**: Aggregations, time series, anomaly detection, machine learning
23 
24## Core Workflow
25 
261. **Discover Resources**: List available clusters and databases in subscription. If the target table's location is unknown and multiple candidate clusters, databases, or Log Analytics workspaces exist, batch the search (see Pattern 6) and only report "not found" after all candidates are checked.
272. **Explore Schema**: Retrieve table structures to understand data model
283. **Query Data**: Execute KQL queries for analysis, filtering, aggregation
294. **Analyze Results**: Process query output for insights and reporting
30 
31## Query Patterns
32 
33### Pattern 1: Basic Data Retrieval
34Fetch recent records from a table with simple filtering.
35 
36**Example KQL**:
37```kql
38Events
39| where Timestamp > ago(1h)
40| take 100
41```
42 
43**Use for**: Quick data inspection, recent event retrieval
44 
45### Pattern 2: Aggregation Analysis
46Summarize data by dimensions for insights and reporting.
47 
48**Example KQL**:
49```kql
50Events
51| summarize count() by EventType, bin(Timestamp, 1h)
52| order by count_ desc
53```
54 
55**Use for**: Event counting, distribution analysis, top-N queries
56 
57### Pattern 3: Time Series Analytics
58Analyze data over time windows for trends and patterns.
59 
60**Example KQL**:
61```kql
62Telemetry
63| where Timestamp > ago(24h)
64| summarize avg(ResponseTime), percentiles(ResponseTime, 50, 95, 99) by bin(Timestamp, 5m)
65| render timechart
66```
67 
68**Use for**: Performance monitoring, trend analysis, anomaly detection
69 
70### Pattern 4: Join and Correlation
71Combine multiple tables for cross-dataset analysis.
72 
73**Example KQL**:
74```kql
75Events
76| where EventType == "Error"
77| join kind=inner (
78 Logs
79 | where Severity == "Critical"
80) on CorrelationId
81| project Timestamp, EventType, LogMessage, Severity
82```
83 
84**Use for**: Root cause analysis, correlated event tracking
85 
86### Pattern 5: Schema Discovery
87Explore table structure before querying.
88 
89**Tools**: `kusto_table_schema_get`
90 
91**Use for**: Understanding data model, query planning
92 
93### Pattern 6: Batch Search Across Candidate Sources
94When a table's location is unknown and there are several candidate clusters, databases, or workspaces, batch read-only metadata discovery instead of querying candidates one at a time. List tables in each candidate database or workspace and match the exact table name before querying data.
95 
96After confirming which sources contain the table, query those sources together when needed:
97```kql
98union workspace('ws1').Requests, workspace('ws2').Requests
99| take 1
100```
101 
102**Use for**: Locating a table among many candidate resources without confusing an empty result with a missing table
103 
104## Key Data Fields
105 
106When executing queries, common field patterns:
107- **Timestamp**: Time of event (datetime) - use `ago()`, `between()`, `bin()` for time filtering
108- **EventType/Category**: Classification field for grouping
109- **CorrelationId/SessionId**: For tracing related events
110- **Severity/Level**: For filtering by importance
111- **Dimensions**: Custom properties for grouping and filtering
112 
113## Result Format
114 
115Query results include:
116- **Columns**: Field names and data types
117- **Rows**: Data records matching query
118- **Statistics**: Row count, execution time, resource utilization
119- **Visualization**: Chart rendering hints (timechart, barchart, etc.)
120 
121## KQL Best Practices
122 
123**🔵 Query Patterns:**
124- Use `summarize` for aggregations instead of `count()` alone
125- Use `bin()` for time bucketing in time series
126- Use `project` to select only needed columns
127- Use `extend` to add calculated fields
128 
129**🟡 Common Functions:**
130- `ago(timespan)`: Relative time (ago(1h), ago(7d))
131- `between(start .. end)`: Range filtering
132- `startswith()`, `contains()`, `matches regex`: String filtering
133- `parse`, `extract`: Extract values from strings
134- `percentiles()`, `avg()`, `sum()`, `max()`, `min()`: Aggregations
135 
136## Best Practices
137 
138- Filter early with time range filters to optimize query performance and use indexed columns first
139- Use `take` or `limit` for exploratory queries to avoid large result sets
140- Leverage `summarize` for aggregations instead of client-side processing
141- Store frequently-used queries as functions in the database
142- Use materialized views for repeated aggregations
143- Monitor query performance and resource consumption
144- Apply data retention policies to manage storage costs
145- Use streaming ingestion for real-time analytics (< 1 second latency)
146- Integrate with Azure Monitor for operational insights
147 
148## MCP Tools Used
149 
150| Tool | Purpose |
151|------|---------|
152| `kusto_cluster_list` | List all Azure Data Explorer clusters in a subscription |
153| `kusto_database_list` | List all databases in a specific Kusto cluster |
154| `kusto_query` | Execute KQL queries against a Kusto database |
155| `kusto_table_schema_get` | Retrieve schema information for a specific table |
156 
157**Required Parameters**:
158- `subscription`: Azure subscription ID or display name
159- `cluster`: Kusto cluster name (e.g., "mycluster")
160- `database`: Database name
161- `query`: KQL query string (for query operations)
162- `table`: Table name (for schema operations)
163 
164**Optional Parameters**:
165- `resource-group`: Resource group name (for listing operations)
166- `tenant`: Azure AD tenant ID
167 
168## Fallback Strategy: Azure CLI Commands
169 
170If Azure MCP Kusto tools fail, timeout, or are unavailable, use Azure CLI commands as fallback.
171 
172### CLI Command Reference
173 
174| Operation | Azure CLI Command |
175|-----------|-------------------|
176| List clusters | `az kusto cluster list --resource-group <rg-name>` |
177| List databases | `az kusto database list --cluster-name <cluster> --resource-group <rg-name>` |
178| Show cluster | `az kusto cluster show --name <cluster> --resource-group <rg-name>` |
179| Show database | `az kusto database show --cluster-name <cluster> --database-name <db> --resource-group <rg-name>` |
180 
181### KQL Query via Azure CLI
182 
183For queries, use the Kusto REST API or direct cluster URL:
184```bash
185az rest --method post \
186 --url "https://<cluster>.<region>.kusto.windows.net/v1/rest/query" \
187 --body "{ \"db\": \"<database>\", \"csl\": \"<kql-query>\" }"
188```
189 
190### When to Fallback
191 
192Switch to Azure CLI when:
193- MCP tool returns timeout error (queries > 60 seconds)
194- MCP tool returns "service unavailable" or connection errors
195- Authentication failures with MCP tools
196- Empty response when database is known to have data
197 
198## Common Issues
199 
200- **Access Denied**: Verify database permissions (Viewer role minimum for queries)
201- **Query Timeout**: Optimize query with time filters, reduce result set, or increase timeout
202- **Syntax Error**: Validate KQL syntax - common issues: missing pipes, incorrect operators
203- **Empty Results**: Check time range filters (may be too restrictive), verify table name
204- **Table Location Unknown**: Use Pattern 6 to batch-search all candidate sources before concluding the data does not exist
205- **Cluster Not Found**: Check cluster name format (exclude ".kusto.windows.net" suffix)
206- **High CPU Usage**: Query too broad - add filters, reduce time range, limit aggregations
207- **Ingestion Lag**: Streaming data may have 1-30 second delay depending on ingestion method
208 
209## Use Cases
210 
211- **Log Analytics**: Application logs, system logs, audit logs
212- **IoT Analytics**: Sensor data, device telemetry, real-time monitoring
213- **Security Analytics**: SIEM data, threat detection, security event correlation
214- **APM**: Application performance metrics, user behavior, error tracking
215- **Business Intelligence**: Clickstream analysis, user analytics, operational KPIs
View all files on GitHub →

Similar skills

See all →
Azure app onboardEnd-to-end orchestrator: from a business idea, app idea, or existing app to running Azure deployment with cost estimates and pre-deploy approval. Analyzes your app, auto-detects the right Azure services, scaffolds infrastructure code, and deploys — tailored to your app, not a template. Handles moving existing apps to Azure without rewriting or with minimal changes. WHEN: bring your app to Azure, plan my app, cost to run, is my code ready to deploy, deploy my app to the cloud, deploy all my services, what Azure services do I need, plan my Azure deployment, deploy my new app to Azure, one-click deploy, I have an app and want it on Azure, migrate my app to Azure, help me get started, build an app, no code yet, starter project. DO NOT USE FOR: use azd for deployment(use azure-deploy), optimizing existing costs (use cost-optimization), code readiness checks only (use azure-app-onboard-prereq).by microsoft · ★ 3.1kAzure App Onboard Prereq — Repository EvaluationAssess whether source code is ready to deploy to Azure — the check BEFORE infrastructure work. Evaluates build health, app completeness, dependencies and local services, stack compatibility, and deployment feasibility. Answers questions about what your app needs before it can be deployed — frameworks, dependencies, and configuration. Checks whether dependencies are compatible and identifies deployment blockers and unsupported frameworks. WHEN: "evaluate my repo", "is my app ready to deploy", "what does my app need to deploy", "what do I need before deploying", "does my app need", "can I ship this to Azure", "scan my repo for issues", "is this app deployable", "check if my app is ready for Azure", "do I need a Dockerfile", "what's blocking my deployment", "are there any blockers", "are my dependencies compatible", "does Azure support my framework", "what needs to change before deploying", "check my app configuration".by microsoft · ★ 3.1kAzure aigatewayConfigure Azure API Management as an AI Gateway for AI models, MCP tools, and agents. WHEN: semantic caching, token limit, content safety, load balancing, AI model governance, MCP rate limiting, jailbreak detection, add Azure OpenAI backend, add AI Foundry model, test AI gateway, LLM policies, configure AI backend, token metrics, AI cost control, convert API to MCP, import OpenAPI to gateway.by microsoft · ★ 1.6kDocker MCP gatewayDocker's own CLI plugin: run any server from the Docker MCP Catalog in its own container, behind one connection, with secrets kept out of env vars.by docker · ★ 1.6kElisymOpen infrastructure for AI agents to discover and pay each otherby elisymlabs · ★ 17Technical Codebase Discovery & Onboarding PromptA prompt designed to guide a deep technical analysis of a code repository to accelerate developer onboarding. It instructs an AI to analyze the entire codebase and generate a structured Markdown document covering architecture, technology stack, key components, execution and data flows, integrations, testing, security, and build/deployment, serving as a technical reference guide.by Valdecir Carvalho

More from microsoft

Playwright MCPMicrosoft's browser automation server: your AI opens pages, clicks, fills forms and reads the page through the accessibility tree.by microsoft · ★ 37.5kSkillOpt-Sleep: usage-driven self-evolution for a local Claude agentUse when the user wants their Claude agent to self-improve from past usage, asks about a nightly/offline 'sleep' or 'dream' cycle, memory/skill consolidation, or says things like 'make my agent better the more I use it', 'review my past sessions', 'learn my prby microsoft · ★ 17.3kAzure app onboardEnd-to-end orchestrator: from a business idea, app idea, or existing app to running Azure deployment with cost estimates and pre-deploy approval. Analyzes your app, auto-detects the right Azure services, scaffolds infrastructure code, and deploys — tailored to your app, not a template. Handles moving existing apps to Azure without rewriting or with minimal changes. WHEN: bring your app to Azure, plan my app, cost to run, is my code ready to deploy, deploy my app to the cloud, deploy all my services, what Azure services do I need, plan my Azure deployment, deploy my new app to Azure, one-click deploy, I have an app and want it on Azure, migrate my app to Azure, help me get started, build an app, no code yet, starter project. DO NOT USE FOR: use azd for deployment(use azure-deploy), optimizing existing costs (use cost-optimization), code readiness checks only (use azure-app-onboard-prereq).by microsoft · ★ 3.1kAzure App Onboard Prereq — Repository EvaluationAssess whether source code is ready to deploy to Azure — the check BEFORE infrastructure work. Evaluates build health, app completeness, dependencies and local services, stack compatibility, and deployment feasibility. Answers questions about what your app needs before it can be deployed — frameworks, dependencies, and configuration. Checks whether dependencies are compatible and identifies deployment blockers and unsupported frameworks. WHEN: "evaluate my repo", "is my app ready to deploy", "what does my app need to deploy", "what do I need before deploying", "does my app need", "can I ship this to Azure", "scan my repo for issues", "is this app deployable", "check if my app is ready for Azure", "do I need a Dockerfile", "what's blocking my deployment", "are there any blockers", "are my dependencies compatible", "does Azure support my framework", "what needs to change before deploying", "check my app configuration".by microsoft · ★ 3.1kAzure Compliance & Security AuditingRun Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.by microsoft · ★ 3.1kAzure aigatewayConfigure Azure API Management as an AI Gateway for AI models, MCP tools, and agents. WHEN: semantic caching, token limit, content safety, load balancing, AI model governance, MCP rate limiting, jailbreak detection, add Azure OpenAI backend, add AI Foundry model, test AI gateway, LLM policies, configure AI backend, token metrics, AI cost control, convert API to MCP, import OpenAPI to gateway.by microsoft · ★ 1.6k

Your agent, with every skill.

Connect once. Free when signed in.

Connect MCP