Agent Foskett Academy • KQL Academy • Module 11 • Lesson 137

Lesson 137 — The Sign-In Was Successful but the Session Wasn't Normal

The account signed in successfully.

MFA was satisfied. Conditional Access did not block the request. The application was familiar. If the investigation stopped at authentication, the event might look harmless.

But authentication is only the doorway. What matters next is what the identity actually did after it got inside. In this lesson we take the successful sign-in context from Microsoft Entra and then move into CloudAppEvents to investigate post-authentication activity across Microsoft 365 and connected cloud applications.

The sign-in told us the account got in. The session told us whether the behaviour still looked like the user.
Agent Foskett KQL Academy successful sign-in abnormal session investigation
What you will investigate

A successful sign-in followed by cloud activity that does not fit the user's normal behaviour.

✓ Establish the successful sign-in context
✓ Hunt post-authentication cloud actions
✓ Identify uncommon user activity
✓ Build the session timeline

The investigation begins

10:14 UTC ↓ Successful Microsoft Entra sign-in ↓ MFA satisfied ↓ Conditional Access succeeds ↓ Nothing obvious is blocked ↓ 10:19 Cloud application activity begins ↓ New actions appear ↓ Objects the user rarely touches are accessed ↓ The activity pattern changes ↓ QUESTION Was the sign-in legitimate... but the session no longer normal?

Learning objectives

Use sign-in context to anchor an investigation, then hunt post-authentication activity in CloudAppEvents, compare the user's normal application/action profile, inspect uncommon-user enrichment and reconstruct what the identity did after authentication.

Why this does not duplicate Lesson 131

Lesson 131 investigated whether the sign-in itself made sense for the identity. Lesson 137 assumes the authentication succeeded and asks a different question: what did the authenticated session do next?

Step 1 — anchor the investigation on the successful sign-in

Start in SigninLogs. Capture the successful event's time, source, application, resource, device and access-control context. This gives us the doorway into the session.

anchor-successful-signin.kql
1234567891011121314151617
let TargetUser = "alex.wilson@contoso.com";
SigninLogs
| where TimeGenerated > ago(24h)
| where UserPrincipalName =~ TargetUser
| where ResultType == "0"
| project TimeGenerated,
          UserPrincipalName,
          AppDisplayName,
          ResourceDisplayName,
          IPAddress,
          Location,
          ClientAppUsed,
          ConditionalAccessStatus,
          AuthenticationRequirement,
          DeviceDetail,
          CorrelationId
| order by TimeGenerated desc

Keep the timestamp

The exact sign-in time is crucial because the next stage of the investigation is temporal. We want to know what cloud activity begins immediately after authentication and whether it uses the same or related source context.

Successful authentication is not a behavioural verdict

A legitimate authentication flow can still lead into malicious activity if credentials, tokens or sessions are abused. Treat success as a fact about authentication, not as proof of benign behaviour.

Step 2 — move into CloudAppEvents

CloudAppEvents contains activity involving accounts and objects in Office 365 and other cloud applications connected through Microsoft Defender for Cloud Apps. Use it to see what the identity did after authentication.

review-post-authentication-cloud-activity.kql
12345678910111213141516
let TargetUser = "alex.wilson@contoso.com";
CloudAppEvents
| where Timestamp > ago(24h)
| where AccountId =~ TargetUser
       or AccountDisplayName =~ TargetUser
| project Timestamp,
          Application,
          ActionType,
          ActivityType,
          ObjectName,
          ObjectType,
          IPAddress,
          CountryCode,
          City,
          UserAgent
| order by Timestamp asc

Important environment note

SigninLogs is commonly queried in Log Analytics or Sentinel, while CloudAppEvents is part of Microsoft Defender XDR advanced hunting. Treat the timestamp and identity as your pivots unless your environment has brought the relevant data into a common hunting surface.

CloudAppEvents requires data

The table depends on Microsoft Defender for Cloud Apps and connected cloud application activity. If the service or Microsoft 365 activities are not connected, the table may be empty or unavailable.

Step 3 — establish the user's normal application and action profile

A session becomes interesting when its actions differ from what the user normally does. Summarize the last seven days by application and action type.

baseline-cloud-actions.kql
12345678910
let TargetUser = "alex.wilson@contoso.com";
CloudAppEvents
| where Timestamp > ago(7d)
| where AccountId =~ TargetUser
       or AccountDisplayName =~ TargetUser
| summarize ActivityCount=count(),
            FirstSeen=min(Timestamp),
            LastSeen=max(Timestamp)
          by Application, ActionType
| order by ActivityCount desc

Normal behaviour is personal

A finance user may regularly export reports. A security administrator may perform privileged operations. A user who normally reads email and documents but suddenly performs rare administrative or bulk actions deserves a different level of scrutiny.

Application alone is not enough

A familiar application can contain unfamiliar behaviour. Seeing “SharePoint” or “Exchange Online” does not tell you whether the activity inside that application was normal for the identity.

Step 4 — use uncommon-user enrichment

Microsoft Defender for Cloud Apps can enrich events with UncommonForUser and LastSeenForUser. These fields can help identify attributes that are unusual for the account.

hunt-uncommon-cloud-activity.kql
123456789101112131415
let TargetUser = "alex.wilson@contoso.com";
CloudAppEvents
| where Timestamp > ago(7d)
| where AccountId =~ TargetUser
       or AccountDisplayName =~ TargetUser
| where tostring(UncommonForUser) != ""
| project Timestamp,
          Application,
          ActionType,
          IPAddress,
          CountryCode,
          City,
          UncommonForUser,
          LastSeenForUser
| order by Timestamp desc

What UncommonForUser means

The field lists event attributes that Defender for Cloud Apps considers uncommon for the user. It is an investigative accelerator, not an automatic malicious classification.

What LastSeenForUser adds

LastSeenForUser can indicate how recently a specific attribute was seen for the identity. A negative value can indicate an attribute being seen for the first time, while positive values represent days since it was last observed.

Step 5 — look for bursts of post-authentication activity

Attackers often move quickly once they have access. Group cloud activity into short windows and count both the volume and variety of actions.

measure-session-activity-bursts.kql
123456789101112
let TargetUser = "alex.wilson@contoso.com";
CloudAppEvents
| where Timestamp > ago(24h)
| where AccountId =~ TargetUser
       or AccountDisplayName =~ TargetUser
| summarize ActivityCount=count(),
            ActionCount=dcount(ActionType),
            Apps=make_set(Application, 20),
            Actions=make_set(ActionType, 30),
            Countries=make_set(CountryCode, 10)
          by bin(Timestamp, 15m), IPAddress
| order by Timestamp asc

Volume can be a clue

A sudden burst of many actions across multiple applications can be interesting, especially if the user's normal behaviour is quiet. But bulk legitimate work, automation and administrative tools can produce similar patterns.

Variety matters too

One repetitive action may be automation. A rapid sequence of mailbox, file, sharing and administrative activity can tell a different story. Count action diversity as well as raw event volume.

Step 6 — build the post-authentication timeline

Now lay the cloud activity out chronologically and keep the network, user-agent and anomaly-enrichment fields beside each action.

build-abnormal-session-timeline.kql
123456789101112131415161718192021
let TargetUser = "alex.wilson@contoso.com";
CloudAppEvents
| where Timestamp > ago(24h)
| where AccountId =~ TargetUser
       or AccountDisplayName =~ TargetUser
| project Timestamp,
          Application,
          ActionType,
          ActivityType,
          ObjectName,
          ObjectType,
          IPAddress,
          CountryCode,
          City,
          Isp,
          UserAgent,
          IsAdminOperation,
          IsAnonymousProxy,
          UncommonForUser,
          LastSeenForUser
| order by Timestamp asc

Compare source continuity

If the post-authentication activity uses the same IP or expected source as the sign-in, that is useful context. If the cloud activity suddenly appears from another country, proxy or unfamiliar client, the session deserves deeper investigation.

Look at the objects

ObjectName, ObjectType and activity fields can reveal whether the account touched files, folders or other resources that do not match its normal work. Behaviour becomes easier to explain when you know what was acted upon.

Evidence table

ObservationWhat it supportsWhat it does not prove
Successful sign-inThe authentication completed successfully.That the subsequent session is benign.
Familiar applicationThe user accessed an application they have used before.That the actions inside it were normal.
UncommonForUser populatedSome event attributes are unusual for the identity.That the event is malicious.
First-seen attributeAn attribute has not previously been observed for the user in the enrichment history.That an attacker introduced it.
High activity burstMany cloud actions occurred in a short window.That automation or bulk legitimate work is impossible.
New source or user agent after sign-inThe session context differs from earlier observed activity.That session hijacking is confirmed without corroboration.

Agent Foskett's investigation

10:14 Successful sign-in ↓ MFA and Conditional Access appear normal ↓ The analyst keeps the timestamp ↓ CloudAppEvents is queried ↓ 10:19 Activity begins in a familiar application ↓ But the action type is uncommon for this user ↓ More cloud actions follow ↓ The burst crosses applications ↓ UncommonForUser identifies new attributes ↓ The source and user agent are compared ↓ The session no longer fits the identity's normal pattern ↓ The successful sign-in is no longer the end of the investigation ↓ It is the start of the session timeline
The authentication looked normal because we were asking an authentication question. The cloud activity looked wrong because we finally asked what the session did.

Investigation questions to ask next

  • What exact cloud actions occurred after the sign-in?
  • Were those actions normal for this user and application?
  • Did the account touch unusual files, folders or other objects?
  • Were any activities marked uncommon for the user?
  • Did the IP address, country, ISP or user agent change after authentication?
  • Did the session perform administrative operations?
  • Did activity volume or action diversity suddenly increase?
  • Were sharing, download, mailbox or permission changes involved?
  • Did the same session affect other identities or resources?
  • Should sessions be revoked while the investigation continues?

Lesson 137 key takeaways

  • A successful sign-in is the beginning of a session, not the end of an investigation.
  • Use SigninLogs to anchor the authentication context.
  • Use CloudAppEvents to investigate post-authentication cloud behaviour where available.
  • Cloud application activity should be compared with the user's own baseline.
  • Familiar applications can still contain abnormal actions.
  • UncommonForUser and LastSeenForUser can accelerate anomaly investigation.
  • Short bursts and diverse actions can reveal suspicious session behaviour.
  • Network and user-agent continuity help test whether the session remains consistent.
  • CloudAppEvents availability depends on Defender for Cloud Apps and connected activity sources.
  • The most useful question after successful authentication is often: what happened next?

Continue your KQL investigation training

Lesson 137 continues Module 11: Identity Threat Hunting. Next we follow one identity across several security tables instead of investigating each telemetry source separately.

Related Agent Foskett Investigations

Continue the session-investigation theme with cases where successful authentication was only the first clue and later activity changed the interpretation.

🔎 KQL Academy — Module 11: Identity Threat Hunting

Use KQL to investigate identity behaviour as evidence.

Investigate abnormal post-authentication sessions with KQL

Lesson 137 of the Agent Foskett KQL Academy teaches analysts how to anchor a successful Microsoft Entra sign-in with SigninLogs and then investigate post-authentication cloud behaviour using Microsoft Defender XDR CloudAppEvents.

CloudAppEvents identity investigation in Microsoft Defender XDR

CloudAppEvents provides activity involving accounts and objects in Microsoft 365 and other connected cloud applications. Analysts can use application, action, object, source, user-agent and uncommon-user enrichment to determine whether an authenticated session still fits the legitimate identity.