Skip to content

KQL for First-Line Security Investigations in Microsoft Sentinel

Admin
October 5, 2026
12 min read
Intermediate
💻 Target OS: Ubuntu 24.04+ / Windows Server 2025

Before you begin

  • Applies to:First-line investigations in Microsoft Sentinel using Kusto Query Language.
  • Where to start:Open Logs in the workspace that contains the relevant telemetry.
  • What you need:Have query permissions, the incident time range and entities, and the table names used by your connectors.
Guide tools
Guide tools
0/0 Steps (0%)

Kusto Query Language (KQL) lets an analyst move from a broad event set to a small, explainable set of records. This guide uses Microsoft Sentinel’s Logs experience and the SigninLogs table to practice time scoping, projection, filtering, sorting, and aggregation.

The examples are read-only. They assume Entra sign-in data is connected to the workspace; tables and columns depend on enabled data sources and your tenant configuration.

Microsoft Sentinel Logs view with a time-bounded SigninLogs KQL query and matching sign-in records

Figure 1: Start with a bounded query, inspect representative rows, then add conditions that answer a specific question.


01

Open the Correct Sentinel Workspace

Query Scope

Open the intended Microsoft Sentinel workspace and its Logs view. Confirm the workspace name, selected time range, and that the Microsoft Entra sign-in connector or equivalent export is configured. Sentinel usage and retention can affect cost, so use an approved workspace and follow your organization’s data-handling rules.

Workspace: la-soc-lab
Data needed: Entra sign-in logs
Initial range: Last 24 hours (change to match the case timeline)
❯ Illustrative Output (Results Vary)
The workspace is in scope and the analyst has query permission.

02

Check What the Workspace Actually Contains

Schema Check

Run a small query first. Confirm recent records exist and inspect their field names before relying on a copied query. For ingestion-delay analysis, compare TimeGenerated (workspace ingestion time) with CreatedDateTime (sign-in event time) when the latter is present.

SigninLogs
| where TimeGenerated >= ago(24h)
| take 5
❯ Illustrative Output (Results Vary)
Confirm: UserPrincipalName, AppDisplayName, IPAddress,
ResultType, ResultDescription, CorrelationId, and timestamps

03

Project the Fields You Need

First Pass

Filter by a bounded time range, select only useful columns, sort newest first, and cap the first result set. A small projection is easier to review and safer to export than every field in the source record.

SigninLogs
| where TimeGenerated >= ago(24h)
| project TimeGenerated, CreatedDateTime, UserPrincipalName,
AppDisplayName, IPAddress, ResultType,
ResultDescription, ConditionalAccessStatus, CorrelationId
| sort by TimeGenerated desc
| take 100
❯ Illustrative Output (Results Vary)
Review rows in context; preserve the workspace and query time range
with any exported evidence.

04

Find Repeated Failures by Source and Hour

Triage Pivot

In the Entra sign-in schema, a successful result commonly has ResultType == “0”. This query groups other results by IP address and hour to make repeated failures easier to spot. It is a prioritization view, not a brute-force verdict: shared egress, password mistakes, service accounts, and legacy applications can produce clusters.

SigninLogs
| where TimeGenerated >= ago(24h)
| where ResultType != "0"
| summarize Attempts=count(),
Users=dcount(UserPrincipalName),
Apps=dcount(AppDisplayName)
by IPAddress, bin(TimeGenerated, 1h)
| sort by Attempts desc
❯ Illustrative Output (Results Vary)
Candidate: 198.51.100.42 | 8 failures | 3 users | 2 apps
Next: inspect the raw records, identity context, client, and time pattern.

05

Narrow the Search to a Case Entity

Correlation

Replace the sample UPN with the exact case identity, or use a correlation ID from a known event. Compare the user’s expected location, application, device, authentication result, and adjacent sign-ins. Use the event timestamp as well as the workspace ingestion timestamp when building a timeline.

let targetUser = "[email protected]";
SigninLogs
| where TimeGenerated between (ago(24h) .. now())
| where UserPrincipalName =~ targetUser
| project TimeGenerated, CreatedDateTime, UserPrincipalName,
AppDisplayName, IPAddress, ResultType, ResultDescription,
DeviceDetail, ConditionalAccessStatus, CorrelationId
| sort by TimeGenerated asc
❯ Illustrative Output (Results Vary)
Use the query result to identify records to open and correlate;
do not infer user intent from a location or IP alone.

06

Make the Query Repeatable

Case Notes

Save the query with a clear name, replace broad time ranges with the incident window when appropriate, and record the workspace, table, time zone, query run time, and any missing fields. If the result suggests an incident, follow the existing incident playbook and pivot into the relevant identity or endpoint investigation.

Question answered:
Workspace and table:
Query time range and time zone:
Key event IDs / correlation IDs:
Observed facts:
Interpretation and confidence:
Next owner and action:
❯ Illustrative Output (Results Vary)
Conclusion is traceable to a bounded query and specific source records.

Comments