Lesson 23 — Microsoft Entra Log Analytics and KQL
Microsoft Entra logs become far more powerful when they are queried with Kusto Query Language in a Log Analytics workspace.
KQL allows administrators and security analysts to filter millions of identity events, isolate failures, group suspicious behaviour, review Conditional Access results and correlate user and workload identity activity.
This lesson introduces the Microsoft Entra Log Analytics tables, core KQL operators and a repeatable investigation workflow for sign-ins, audit events, service principals and managed identities.

What you will learn
This lesson introduces the Microsoft Entra tables, KQL operators and practical identity investigation patterns used in Log Analytics and Microsoft Sentinel.
Learning objectives
After completing this lesson, you should be able to investigate Microsoft Entra activity using Log Analytics and KQL.
- Identify the main Microsoft Entra Log Analytics tables.
- Use core KQL operators to filter, shape and summarize identity data.
- Investigate failed and risky user sign-ins.
- Review audit activity and administrative changes.
- Query service principal and managed identity authentication.
- Build clear, reusable investigation queries.
What you need before starting
Microsoft Entra activity logs must already be routed to a Log Analytics workspace through Diagnostic Settings or the Microsoft Entra data connector for Microsoft Sentinel.
You also need permission to read the workspace and query the relevant tables.
From portal filtering to KQL investigation
The Microsoft Entra admin centre is useful for reviewing individual events. Log Analytics becomes more valuable when the investigation requires scale, repeatability, grouping or comparison across many events.
Main Microsoft Entra Log Analytics tables
| Table | Data captured | Typical investigation |
|---|---|---|
| SigninLogs | Interactive user sign-ins | Failed sign-ins, MFA, Conditional Access, device and risk analysis |
| AuditLogs | Directory and configuration changes | Role changes, policy changes, application changes and user administration |
| AADNonInteractiveUserSignInLogs | Background user token activity | Refresh tokens, client applications and silent authentication |
| AADServicePrincipalSignInLogs | Service principal authentication | Client secrets, certificates, app-only access and automation |
| AADManagedIdentitySignInLogs | Managed identity authentication | Azure resource token requests and workload identity activity |
| ProvisioningLogs | Provisioning and lifecycle operations | Failed account creation, updates, synchronisation and deprovisioning |
Start with a clear question
A query should answer a specific operational question, such as:
- Why was this user blocked?
- Which applications generated the most failures?
- Who changed the Conditional Access policy?
- Which service principal used this IP address?
Start with a small time range
Time filtering reduces noise, improves performance and helps prevent unrelated events from distorting the investigation.
The where operator
where filters rows that meet a condition.
The case-insensitive equality operator =~ is helpful when matching text values exactly.
The project operator
project selects the fields displayed in the result.
The order by operator
Sort the newest or most important evidence first.
The take operator
take returns a limited sample and is useful while exploring an unfamiliar table.
The distinct operator
Use distinct to identify the unique values present in a field.
The summarize operator
summarize groups events and calculates totals.
The extend operator
extend creates a calculated field without removing the original columns.
Understand result codes
For many sign-in investigations, ResultType contains the sign-in error code and a value of 0 usually represents success. ResultDescription provides a readable explanation.
Always validate the event details because interrupted authentication and application-side failures can require additional context.
Latest user sign-ins
Failed user sign-ins
Failures by user
Failures by application
Conditional Access results
Open the original sign-in event when policy-level evaluation details are needed.
Risky sign-ins
Sign-ins from new countries
Device information
Device details are stored in a dynamic field and can be extracted with tostring().
Authentication requirement
This provides a useful overview, but detailed MFA troubleshooting may require the AuthenticationDetails field and the original event.
Audit log investigations
AuditLogs records changes made to Microsoft Entra objects and configuration.
Failed audit operations
Search for policy changes
Service principal sign-ins
Service principal failures
Managed identity activity
Non-interactive user sign-ins
Agent Foskett investigation: “The user could not sign in yesterday”
- Define the user, approximate time and application involved.
- Query SigninLogs for the user and a narrow time range.
- Sort events chronologically and review ResultType and ResultDescription.
- Compare the application, IP address, device and location fields.
- Review ConditionalAccessStatus, authentication requirement and risk fields.
- Use the correlation ID to match portal details or application logs when necessary.
- Check AADNonInteractiveUserSignInLogs if the problem occurred during background token renewal.
- Confirm the root cause against the original sign-in event before documenting the finding.
Build reusable queries with let
The let statement keeps important values at the top of the query.
Reduce noise early
Filter by time, user, application or result near the beginning of the query. Project only the fields needed to answer the question.
This makes the query easier to read and usually more efficient.
Do not assume every table has identical fields
Interactive, non-interactive, service principal and managed identity tables have related but different schemas.
Use take 10, the schema pane or Microsoft table reference before reusing a query across tables.
Know when to return to the portal
KQL is excellent for finding patterns and isolating events. The Microsoft Entra sign-in details experience may still provide the clearest policy evaluation, authentication step and diagnostic explanation for a single event.
Common KQL mistakes
- Querying the wrong sign-in table.
- Using an excessively large time range.
- Assuming every non-zero result is malicious.
- Ignoring background and workload identity activity.
- Displaying every column instead of projecting useful evidence.
- Failing to validate summarized findings against raw events.
Investigation checklist
- State the question before writing the query.
- Choose the table that represents the identity type.
- Limit the time range.
- Filter early.
- Project useful fields.
- Summarize only after reviewing raw events.
- Preserve correlation IDs and timestamps.
- Document the final evidence and conclusion.
Security best practices
- Save validated investigation queries in a controlled repository.
- Use meaningful query names and comments.
- Protect access to the Log Analytics workspace.
- Review ingestion gaps before relying on a negative result.
- Monitor both human and workload identities.
- Convert repeatable high-value hunts into analytics or scheduled detections where appropriate.
Key takeaways
- Log Analytics provides scalable investigation of Microsoft Entra telemetry using KQL.
- The correct table depends on whether the identity is a user, service principal or managed identity.
- where, project, summarize, extend, order by, take and distinct form the core of many investigations.
- Result codes, Conditional Access, device, authentication, location and risk fields provide essential sign-in context.
- AuditLogs records directory and configuration changes.
- Workload identity tables must be queried separately from user sign-ins.
- Good KQL starts with a clear question and ends with validation against the raw evidence.
Related Agent Foskett resources
Continue learning
Microsoft Entra Log Analytics and KQL investigations
Microsoft Entra activity logs can be queried in Log Analytics using KQL across SigninLogs, AuditLogs, AADNonInteractiveUserSignInLogs, AADServicePrincipalSignInLogs, AADManagedIdentitySignInLogs and ProvisioningLogs.
Microsoft Entra Academy Lesson 23 — Log Analytics and KQL
This Agent Foskett lesson teaches practical KQL operators, failed sign-in analysis, Conditional Access investigation, audit log review and workload identity hunting.
