KQL for Detection and Threat Hunting

Master KQL for Detection and Threat Hunting

Write powerful, efficient KQL queries that turn massive amounts of security data into fast, actionable insights. Master Kusto Query Language to hunt threats, build high-fidelity detections, investigate incidents, and automate response; all inside Microsoft Sentinel, Defender XDR, and Log Analytics.

Included with Premium, from $19.99/month, or $179/year and save 25%. Preview the first module free, no account needed.
Your subscription also includes the Practice Hub: graded scenarios, forensic cases, query drills and the response playbooks.
View Pricing Take End of Course Exam → 36 CPE Credits

What you'll be able to do

Write advanced, high-performance KQL queries for threat hunting, detection engineering, and incident response
Optimise KQL queries to run efficiently at enterprise scale with millions of records
Build custom detection rules, analytics rules, and scheduled queries in Microsoft Sentinel
Perform fast, effective threat hunting across Microsoft 365, Entra ID, endpoints, cloud, and security logs
Analyze and correlate data from multiple sources to reconstruct attacker activity and timelines
Create reusable KQL functions, workbooks, and automated playbooks that improve daily SOC operations
SEC201 | Premium tier | 14 modules across 5 phases | 36–40 hours at your own pace | 36 CPE credits | Updated June 2026

Course Syllabus

Every module and every lesson. Open a module to see its lessons.

Download the full syllabus (PDF)

Phase 1: Anatomy of KQL

K0
Course OrientationCourse Preview

What KQL for Detection and Threat Hunting teaches: the query language behind every hunt, detection, and investigation in Microsoft Sentinel, Defender XDR, and Log Analytics.

8 lessonsHide lessons
  1. 0.1 Three Questions You Cannot Answer Without KQLPreview
  2. 0.2 The Microsoft Security Data ModelPreview
  3. 0.3 The Eight Tables You Will Query Every DayPreview
  4. 0.4 Your First Security QueryPreview
  5. 0.5 What This Course BuildsPreview
  6. 0.6 Setting Up Your Lab EnvironmentPreview
  7. Module SummaryPreview
  8. Check My KnowledgePreview

Phase 2: Intermediate Techniques

Phase 3: Advanced Patterns

Phase 4: Mastery

Phase 0: Course Resources

K91
Cookbooks

Five procedures for the recurring problems, worked against documented platform behavior: ingestion lag, table plans, memory and truncation limits, service limits on rules, and transformation constraints.

5 lessonsHide lessons
  1. A Query Returns Nothing
  2. A Query Is Too Slow
  3. From Query to Detection Rule
  4. Parsing an Unfamiliar Log Source
  5. Running a Hunt
K92
Lab Setup

A Log Analytics workspace you build and populate yourself, free, with the activity each module's queries need and the verification that proves it holds data.

1 lessonsHide lessons
  1. Building the Environment
K93
Walkthroughs

Ten investigations worked end to end with the output at every step, each turning on a failure that produces no error message: queries that return nothing, too few rows, or exactly the right answer to the wrong question.

10 lessonsHide lessons
  1. Building a Query From a Question
  2. When the Join Lies
  3. The Baseline That Learned the Attack
  4. The Query That Timed Out
  5. The Parse That Half Worked
  6. Reconstructing the Process Tree
  7. The Rule That Fired Four Thousand Times
  8. The Hunt That Proved Nothing
  9. The Dashboard That Improved
  10. Capstone: Spray to Business Email Compromise
K94
Playbooks

Five query patterns by investigative question, each built on the function KQL actually provides for it, with the constraint that decides the design and the false positives it will produce.

5 lessonsHide lessons
  1. First Time Seen
  2. Rare in Population
  3. Volume Anomaly Per Entity
  4. Paired Events in Sequence
  5. Beaconing and Regularity
K95
Playground

Resources for practicing KQL and using it at work: the detection library, a free-run query console, guided investigations, response playbooks, and an open-source DFIR toolkit.

K96
References & Further Reading

External sources this course draws on: Microsoft KQL documentation, the language reference, and community query material.

Course Completion

Course Exam

KQL for Detection and Threat Hunting end-of-course exam: a three-phase simulation testing whether you can apply the method to a situation the course did not walk through.

1 lessonsHide lessons
  1. Course Completion. KQL for Detection and Threat Hunting

Course overview

The KQL for Detection and Threat Hunting course is the core training track for Security Engineers, Detection Engineers, and Threat Hunters who use KQL daily. You'll gain hands-on expertise to:

Write advanced KQL queries for threat hunting, detection engineering, and incident investigation
Optimize queries for speed and efficiency at enterprise scale
Build custom detections, analytics rules, and automated playbooks in Microsoft Sentinel
Analyze data across Microsoft 365, Entra ID, endpoints, cloud workloads, and security logs

By the end, you'll have the confidence and fluency to use KQL as a powerful daily tool, dramatically improving your threat detection, hunting speed, and security operations effectiveness.

How this course works

KQL is a query language, and most people learn it as a set of examples to copy. This course teaches the execution model first, because every performance problem and every wrong answer downstream is a model problem.

1. Understand how the query is processed. Data flows left to right through operators. Where you filter decides both what you get and what it costs.

2. Filter before you shape. The cheapest query is the one that discards rows early. This is the single habit that separates a query that runs at scale from one that times out.

3. Aggregate to answer a question, not to summarize. A summarize with no hypothesis behind it produces a table nobody reads. Know what the number is for before computing it.

4. Join only when the answer needs two sources. Joins are the most expensive thing in the language and the most reached for. Most correlation problems are a filter and a lookup.

5. Turn the query into something that runs without you. A detection rule, a workbook or a scheduled hunt. A query that lives in somebody's notes is a query that runs once.

What this course assumes

No minimum experience and no prerequisite course. The language is built from the first query onward, and the course assumes no prior SQL.

What makes it go faster: access to a Sentinel workspace or Defender advanced hunting with real data. Not required, because every query in the course runs against the Practice Hub, which holds populated tables and known answers.

What this course does not cover: incident response process, detection engineering as a program, and SIEM administration. This is the query language, taught to the depth where you stop copying examples.

Who this course is for

You're a Security Engineer, Detection Engineer, or Threat Hunter who uses KQL daily and wants to move from functional to expert level. This course is built for you if you want to:

Write cleaner, faster, and more powerful KQL queries with confidence
Master advanced KQL techniques specifically for security operations and detection engineering
Build high-fidelity detections and hunting queries that actually find real threats
Reduce query runtime and improve your overall efficiency in Microsoft Sentinel and Defender XDR

In short: if you're ready to become the go-to KQL expert on your team and significantly level up your threat detection and hunting capabilities, this course is for you.

What you'll learn

By the end of this KQL for Detection and Threat Hunting course you will be able to:

Master KQL fundamentals and advanced operators for security use cases
Write efficient queries for threat hunting, anomaly detection, and incident investigation
Build and optimize custom detection and analytics rules in Microsoft Sentinel
Analyze and correlate logs across identities, endpoints, email, cloud, and network data
Use advanced KQL features including joins, summarization, time-series analysis, and functions
Create reusable KQL libraries, workbooks, and automation that scale with your organization

Key course takeaways

Become highly proficient in writing production-grade KQL for real security operations
Build and maintain high-fidelity detections and hunting queries that actually work
Dramatically improve query speed and efficiency at enterprise scale
Develop reusable KQL assets that make you and your team significantly more effective
Master threat hunting and incident investigation using KQL across the Microsoft security stack
Transform from a KQL user into a true KQL power user and detection engineering asset

Things you need to know

What are the prerequisites for this course?

There are no prerequisites. The course teaches KQL from first principles. Familiarity with any query language (SQL, SPL, EQL) will help you move faster, but is not required. Every operator and function is explained at first use with security log examples.

What are the device requirements?

A device with a modern browser. Access to a Microsoft 365 E5 tenant (a developer subscription if you qualify for one, otherwise a 30-day E5 trial) or a Sentinel workspace for hands-on query execution. The course walks you through setup in Module 0.

How will the course benefit your career?

KQL is the query language that powers Microsoft Sentinel, Defender XDR, and Log Analytics. Every detection rule, hunting query, investigation pivot, and operational dashboard runs on KQL. This course gives you the fluency to write queries from scratch, debug them when they fail, and optimize them for production scale.

KQL proficiency is a prerequisite for detection engineering, threat hunting, and advanced security operations roles across the Microsoft ecosystem.

Usage rights and disclaimer

Course materials: Licensed for individual professional development. You may deploy queries, detection rules, and workbooks in your production environment. You may not redistribute course content or share account credentials.

Fictional environment: All scenarios use Northgate Engineering. Any resemblance to real organizations is coincidental.

Version and changelog

Current version: 1.1  |  Last updated: June 2026

June 2026, v1.1: Course renamed to KQL for Detection and Threat Hunting.

June 2026, v1.0: Course page restructured. 14 modules from KQL fundamentals through production detection engineering, threat hunting, and the capstone hunting lab.

This course is actively maintained. Content is updated as the KQL language and Microsoft security data model evolve.

COURSE ASSESSMENT

End of Course Exam

Complete the course, then prove your skills under time pressure. Pass mark: 70. Earn your certificate with CPE credits.

40minutes
3phases
100points
1scenario
Take End of Course Exam

Requires 80% course completion. One random scenario per attempt. Certificate issued on pass.