kql-query-authoring

Generate validated KQL queries for Microsoft Sentinel and Defender XDR.

2|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/msandbu/sentinelday --skill kql-query-authoring-msandbu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kql-query-authoring
Source: https://github.com/msandbu/sentinelday/tree/main/.github/skills/kql-query-authoring
Command: npx skills add https://github.com/msandbu/sentinelday --skill kql-query-authoring-msandbu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill streamlines the creation of accurate and efficient KQL queries for Microsoft Sentinel and Defender XDR, reducing errors and saving valuable investigation time.

Core Features & Use Cases

  • Schema Validation: Ensures queries use correct table and column names.
  • Cross-Platform Compatibility: Adapts queries for both Sentinel and Defender XDR environments.
  • Best Practice Integration: Leverages official Microsoft Learn documentation and community examples.
  • Use Case: When asked to "write a KQL query to find all failed sign-ins in the last 7 days for user '[email protected]'", this skill will generate a validated query, accounting for potential schema differences between Sentinel and Defender XDR.

Quick Start

Use the kql-query-authoring skill to write a KQL query for failed sign-ins in the last 7 days.

Frequently Asked Questions about kql-query-authoring

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

FAQPage Schema
How do I write a KQL query for Microsoft Sentinel that avoids schema errors?

To write a KQL query for Microsoft Sentinel without schema errors, validate table and column names against the actual environment schema. This ensures production-ready queries that execute correctly without failing due to invalid references.

Does KQL syntax for Defender XDR differ from Microsoft Sentinel?

KQL syntax for Defender XDR can differ from Microsoft Sentinel due to cross-platform schema variations. Adapting queries requires checking schema compatibility to ensure the same query works correctly across both security platforms.

What is the best way to create threat hunting queries for Defender XDR?

The best way to create threat hunting queries for Defender XDR is to leverage official Microsoft Learn documentation and community examples. This approach integrates performance and security best practices directly into your query authoring process.

Can I generate a KQL query for failed sign-ins without knowing all table columns?

You can generate a KQL query for failed sign-ins without knowing table columns by using schema validation. The query authoring process automatically verifies correct table and column names against the target environment before generating the final query.

Why does my KQL query fail when moving from Sentinel to Defender XDR?

Your KQL query likely fails when moving from Sentinel to Defender XDR due to cross-platform schema differences. Tables and columns often vary between environments, requiring schema validation and adaptation to ensure cross-platform compatibility.