Lesson 63 — Hunting Suspicious Authentication Patterns
Hunt for authentication anomalies across Microsoft Entra sign-in telemetry, establish account baselines, and investigate evidence before reaching a conclusion.

What you will learn
Find the signal without mistaking every failed login for an attack.
Agent Foskett case file — The password was wrong until it was right
A user account experiences dozens of failed sign-ins from one source IP, followed by a successful authentication. A password spray? An old application password? Or a legitimate user struggling with an expired credential? Agent Foskett follows the timeline before assigning a label.
Learning objectives
- Explain the difference between sign-in attempts, failures and successful authentication.
- Verify the completeness of
SigninLogstelemetry. - Hunt repeated failures and success-after-failure sequences.
- Assess unfamiliar IP addresses and application context against account baselines.
- Document alternative explanations and escalation criteria.
Prerequisites and safe lab boundaries
Use a Microsoft Sentinel-connected Log Analytics workspace with Microsoft Entra SigninLogs ingestion enabled and permission to query it. All examples are read-only. Use approved lab accounts and do not lock accounts, reset credentials or block IP addresses solely because a hunting query returned a match.
Where authentication evidence lives
SigninLogs captures supported interactive user sign-in events ingested from Entra ID. Other relevant sources can include AADNonInteractiveUserSignInLogs, AADServicePrincipalSignInLogs and AuditLogs when connected and available. They have different coverage and event semantics; never assume an absent table means no activity occurred.
Understand the fields before hunting
TimeGenerated: event time used for your hunting window.UserPrincipalName: account identifier; may be empty or inconsistent for some event types.IPAddress: observed source IP; shared egress and proxies can affect interpretation.ResultType: sign-in result code;0generally indicates success.AppDisplayName: target application name.CorrelationId: useful for pivots but not always a unique authentication attempt.
Start with coverage, not suspicion
Check ingestion recency and daily event volumes before using any “no matching results” conclusion. An outage, connector configuration change or retention boundary can create a false impression that activity stopped.
KQL hunt 1 — Validate sign-in data coverage
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
SigninLogs
| where TimeGenerated >= ago(7d)
| summarize Attempts = count(),
Accounts = dcount(UserPrincipalName),
LastEvent = max(TimeGenerated)
by bin(TimeGenerated, 1d)
| order by TimeGenerated ascA gap in the output may reflect ingestion, retention or a genuinely quiet period. Validate the connector and workspace before proceeding.
What a failed sign-in actually means
A failed authentication may result from an expired password, conditional access, a disabled account, MFA requirements, stale credentials or hostile attempts. A large failure count alone cannot distinguish these causes. Review result codes and the business context.
Hunt hypothesis 1 — Repeated failures
Hypothesis: a source IP generating many failed sign-ins across several accounts may warrant investigation for password spraying. Competing explanations include shared corporate egress, a broken authentication client and test automation.
KQL hunt 2 — Repeated failures across accounts
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
let Lookback = 24h;
SigninLogs
| where TimeGenerated >= ago(Lookback)
| where isnotempty(IPAddress) and isnotempty(UserPrincipalName)
| where tostring(ResultType) != "0"
| summarize FailedAttempts = count(),
TargetAccounts = dcount(UserPrincipalName),
SampleAccounts = make_set(UserPrincipalName, 8),
FirstSeen = min(TimeGenerated),
LastSeen = max(TimeGenerated)
by IPAddress
| where FailedAttempts >= 20 and TargetAccounts >= 5
| order by TargetAccounts desc, FailedAttempts descThresholds are illustrative. A NAT gateway or legitimate shared egress can create a high account count. Compare failure codes, geography, client types and known network ownership.
Investigate a candidate IP address
For a returned IP, check whether it is a corporate proxy, VPN concentrator, cloud egress or known partner. Inspect the set of targeted accounts, application names, result codes and the time distribution. Do not label an IP malicious from volume alone.
Hunt hypothesis 2 — Failure followed by success
Hypothesis: a successful sign-in after multiple recent failures may represent a guessed password, but it can also reflect a user correcting their password. The next query creates an investigation timeline for one account; it does not independently establish the sequence as malicious.
KQL hunt 3 — Build a focused authentication timeline
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
let TargetUPN = "analyst@example.com";
SigninLogs
| where TimeGenerated >= ago(48h)
| where UserPrincipalName =~ TargetUPN
| extend Outcome = iff(tostring(ResultType) == "0", "Success", "Other / failure")
| project TimeGenerated, UserPrincipalName,
IPAddress, AppDisplayName, Outcome,
ResultType, ConditionalAccessStatus,
CorrelationId
| order by TimeGenerated asc
| take 300Replace the sample UPN with an authorized test account. The 300-row cap can omit events for busy identities; record that limitation and narrow the window if necessary.
Interpreting a success-after-failure timeline
Look for whether the successful sign-in came from the same IP and application as the failures, how quickly it followed them, and whether the source was previously known. A success is not equivalent to confirmed access to a protected resource; review applicable authentication and access context.
Hunt hypothesis 3 — Unfamiliar source IP
An unfamiliar IP is a useful pivot when paired with an account baseline. It is not proof of impossible travel or compromise. Mobile networks, remote work, VPNs and IPv6 changes can all produce new source addresses.
Build a fair baseline
Use a representative historical window, considering weekdays, shifts, travel and maintenance. Ask whether the account regularly uses multiple networks. A seven-day baseline may be too short for infrequent users, and a long baseline may include already suspicious behavior.
Compare applications and client context
A sign-in to an unexpected application can be more informative than a new IP alone. Check AppDisplayName, authentication requirements, conditional access results and whether the account has a legitimate reason to use that application.
Identity and service accounts are different
Do not apply interactive-user assumptions blindly to service principals and workload identities. When hunting service principal activity, first confirm that AADServicePrincipalSignInLogs is ingested, and build hypotheses around workload schedules, permissions and known applications.
Consider non-interactive sign-ins
Token refreshes and other non-interactive sign-in events may be captured in AADNonInteractiveUserSignInLogs if configured. They are not interchangeable with interactive sign-ins. Document which data streams your hunt includes.
Beware of MFA and Conditional Access misinterpretation
A sign-in row’s status fields require contextual interpretation. Do not treat every failure as an MFA denial, or a successful primary credential check as proof of completed access. Correlate with sign-in details and applicable policy results.
Corroborate with identity changes
When authorized, pivot into AuditLogs to check account changes, app consent, role assignments and other relevant operations near the suspicious sign-in window. Schema details vary by operation, so inspect representative records before building joins.
The attack chain is a hypothesis
Each arrow is an investigative question, not proof that an attacker completed the step.
Tuning thresholds without hiding attacks
Use thresholds to prioritize review, not to declare all lower-volume behavior safe. Consider account sensitivity, frequency, source diversity, application context and the cost of false positives. Validate changes against historical examples.
Document the hunt in a repeatable record
Agent Foskett finding — The forgotten client
The failed attempts came from a shared office IP and were associated with a retired application repeatedly using an outdated password. The later successful sign-in was an employee accessing a different approved application. The raw pattern looked alarming; the timeline and application context changed the assessment.
Lesson: an authentication pattern becomes meaningful only after the evidence is tested.
Hands-on lab — Investigate authentication anomalies
- Verify
SigninLogscoverage for seven days. - Run the multi-account failure query and record its thresholds.
- Choose an authorized candidate or lab account.
- Build a focused 48-hour authentication timeline.
- Compare IP, application and result context against expected behavior.
- Write two plausible non-malicious explanations.
- Record whether the hypothesis is supported, unsupported or inconclusive.
Knowledge check
- Why is a high failed-login count not proof of password spraying?
- What should you check before interpreting zero results?
- How can a corporate NAT affect IP-based hunting?
- Why should interactive and non-interactive sign-ins be distinguished?
- What evidence would justify escalating a suspicious authentication pattern?
Quality and operational checklist
- Queries use Sentinel Log Analytics
SigninLogsand bounded windows. - Thresholds are clearly illustrative and not production-ready detections.
- Missing telemetry and ingestion limitations are documented.
- UTC times and account context are considered.
- No response action is recommended from a single anomaly.
- Three full-width KQL editors have numbered gutters.
- Previous lesson is linked; unpublished Lesson 64 is not clickable.
Agent Foskett takeaway
A failed password is a fact. An attack is a hypothesis. Hunt the sequence, verify the source, examine the application and challenge your assumptions before you escalate.
The Logs Already Knew.
