cso-detection-rule

Builds a scheduled Microsoft Sentinel analytics rule detecting impossible travel in SigninLogs with KQL.

2|Updated Jun 1, 2026
One-click install
npx skills add https://github.com/jay-steenbergen/MSSAMentorAgent --skill cso-detection-rule-jay-steenbergen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cso-detection-rule
Source: https://github.com/jay-steenbergen/MSSAMentorAgent/tree/main/.github/skills/tracks/cybersecurity-ops/cso-detection-rule
Command: npx skills add https://github.com/jay-steenbergen/MSSAMentorAgent --skill cso-detection-rule-jay-steenbergen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Security learners often struggle to move from reading about SIEM detections to actually writing, deploying, and validating one. This Skill walks a learner through creating a real scheduled analytics rule in Microsoft Sentinel that detects impossible travel sign-ins, including the often-skipped steps of entity mapping, false-positive tuning, and deliberately triggering the rule to prove it works. ## Core Features & Use Cases - KQL Detection Query Construction: Builds an impossible-travel query on SigninLogs using serialize and prev() to compare consecutive sign-ins per user across countries within a 60-minute window. - Scheduled Rule Configuration: Wraps the query in a Sentinel scheduled analytics rule with severity, MITRE tactics, run frequency, lookback window, entity mapping (Account, IP), and alert grouping. - False-Positive Tuning and Live Trigger Test: Adds allowlist exclusions for VPN exit IPs and service accounts, then validates end-to-end by switching VPN countries and confirming an incident is created. - Use Case: A cybersecurity student with a Sentinel workspace wants hands-on detection engineering experience; they follow the five phases to ship a working impossible-travel detection and can explain every design decision. ## Quick Start Ask the Mentor to start the cso-detection-rule project and walk you through writing a Sentinel scheduled analytics rule that detects impossible travel sign-ins.

Frequently Asked Questions about cso-detection-rule

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

FAQPage Schema
How do I write a KQL query to detect impossible travel in Sentinel?

Query SigninLogs for successful sign-ins, sort by user and time, then use serialize with prev() to compare each row against the previous one for the same user. Filter where the country changed and the time gap is under 60 minutes.

How do I create a scheduled analytics rule in Microsoft Sentinel?

Go to Configuration, Analytics, Create, Scheduled query rule. Paste your KQL query, set query period and frequency to 1 hour, map Account and IP entities, enable incident creation with alert grouping, then review and create.

Why does prev() return null in my KQL query?

prev() returns null on every row when serialize is missing. KQL is parallelized by default, so row order is undefined until serialize pins the sequence produced by your sort by clause.

How do I reduce false positives in a Sentinel detection rule?

Add exclusion filters to the query for corporate VPN exit IPs, known traveling users, and service accounts using !in or !in~ operators. For production, use Sentinel Watchlists instead of hardcoded values so exclusions can be maintained independently.

How can I test that a Sentinel analytics rule actually fires?

Deliberately trigger it: sign in from one IP, switch your VPN to a different country, and sign in again within the query window. Then check Sentinel Incidents after the next scheduled run to confirm an incident with mapped entities appears.

What are the limitations of this impossible travel detection approach?

It covers one scheduled rule with one query and one round of tuning; it does not use ML behavior analytics, NRT rules, or Fusion correlation. VPN usage makes legitimate travel look impossible, so allowlist tuning is mandatory to avoid noise.