Lesson 155 — The Application Accessed Data Without the User
Lesson 154 established that an OAuth application was granted consent during an already suspicious cloud investigation. Now the next clue appears: the application continues authenticating and reaching organisational resources when there is no corresponding interactive user session.
In this lesson we use KQL to investigate service principal sign-ins, identify the resources the application reached, search Microsoft 365 activity for matching application context and determine whether the granted permissions were actually exercised without the user.

Your case file
The consented application begins generating non-interactive authentication activity after the user stops actively working in Microsoft 365.
Case briefing
Investigation objective
Use Microsoft Entra service principal sign-in telemetry and Microsoft 365 audit data to determine whether the application authenticated after consent, which resources it targeted, whether corresponding user sign-ins were present and whether the evidence supports application-based access independent of an interactive user session.
Investigator's rule
Non-interactive does not automatically mean malicious. Applications and services are designed to operate without a person clicking through every request. The security question is whether this application was authorised, expected and operating within its approved permissions.
Stage 1 — find the application's service principal sign-ins
Pivot from the application identifier discovered in Lesson 154 into AADServicePrincipalSignInLogs. Preserve the application, resource, source IP, location, result and correlation context.
let TargetAppId = "11111111-2222-3333-4444-555555555555";
AADServicePrincipalSignInLogs
| where TimeGenerated > ago(7d)
| where AppId == TargetAppId
| project TimeGenerated,
ServicePrincipalName,
ServicePrincipalId,
AppId,
ResourceDisplayName,
ResourceServicePrincipalId,
IPAddress,
Location,
ResultType,
ResultDescription,
CorrelationId
| order by TimeGenerated ascWhy AppId?
Display names can change or be duplicated. The application ID provides a stronger pivot when following a known application across identity telemetry.
ResourceDisplayName matters
The resource shows what the service principal attempted to access. Authentication to Microsoft Graph, SharePoint or another resource can materially change the impact assessment.
Stage 2 — summarise what the application accessed
Group service principal sign-ins by resource and result. This quickly shows how often the application authenticated, when it first and last appeared and which sources were involved.
let TargetAppId = "11111111-2222-3333-4444-555555555555";
AADServicePrincipalSignInLogs
| where TimeGenerated > ago(7d)
| where AppId == TargetAppId
| summarize SignIns=count(),
FirstSeen=min(TimeGenerated),
LastSeen=max(TimeGenerated),
SourceIPs=make_set(IPAddress, 50),
Locations=make_set(Location, 20)
by ServicePrincipalName,
ResourceDisplayName,
ResultType
| order by SignIns descSuccess proves authentication, not data access
A successful service principal sign-in shows that the application obtained access to a resource context. It does not by itself prove which files, messages or records were read.
Repeated activity changes the story
A single authentication event may be setup or testing. Repeated successful access after the consent event can strengthen the hypothesis that the grant established ongoing application access.
Stage 3 — search Microsoft 365 activity for application context
Now inspect Microsoft 365 audit activity for evidence that can be associated with the application. The exact fields exposed for app-only or service activity vary, so validate the schema and actor fields in your tenant.
let TargetAppId = "11111111-2222-3333-4444-555555555555";
let TargetAppName = "Contoso Document Helper";
OfficeActivity
| where TimeGenerated > ago(7d)
| where OfficeWorkload in ("SharePoint", "OneDrive")
| extend ActorContext = strcat(
tostring(UserId), " ",
tostring(UserKey), " ",
tostring(UserAgent), " ",
tostring(ClientIP))
| where ActorContext has TargetAppId
or ActorContext has TargetAppName
| project TimeGenerated,
OfficeWorkload,
Operation,
UserId,
UserKey,
Site_Url,
SourceFileName,
ClientIP,
UserAgent
| order by TimeGenerated ascSchema validation is essential
OfficeActivity records vary by workload and operation. Application identity may appear differently from interactive user activity. Inspect raw events before assuming a particular field always contains the app ID.
Authentication and resource activity are different layers
Entra tells us the application authenticated. Workload audit evidence can help show what happened after authentication. Keep those conclusions separate until the records are correlated.
Stage 4 — test whether the user was actually active
Query interactive sign-in telemetry for the user during the same window. The absence of a matching user sign-in can support the conclusion that application activity occurred independently, but absence must be interpreted carefully.
let TargetUser = "alex.wilson@contoso.com";
let StartTime = datetime(2026-08-18 14:30:00);
let EndTime = datetime(2026-08-18 15:30:00);
SigninLogs
| where TimeGenerated between (StartTime .. EndTime)
| where UserPrincipalName =~ TargetUser
| project TimeGenerated,
UserPrincipalName,
AppDisplayName,
IPAddress,
Location,
ClientAppUsed,
ResultType
| order by TimeGenerated ascNo sign-in does not mean no session
Existing sessions and tokens can continue operating without generating a fresh interactive sign-in for every action. Do not equate “no new sign-in record” with “the user could not possibly have been involved.”
Application identity is the stronger clue
If service principal telemetry explicitly identifies the application as the authenticating principal, that is stronger evidence of app-driven access than simply observing a gap in user sign-ins.
Stage 5 — build the application-access timeline
Bring service principal authentication and Microsoft 365 workload activity into one chronological view. Use the timeline to test whether application access begins after consent and continues independently of the user's interactive activity.
let TargetAppId = "11111111-2222-3333-4444-555555555555";
let StartTime = datetime(2026-08-18 14:30:00);
let EndTime = datetime(2026-08-18 16:00:00);
union
(
AADServicePrincipalSignInLogs
| where TimeGenerated between (StartTime .. EndTime)
| where AppId == TargetAppId
| project TimeGenerated,
EvidenceType="Service principal sign-in",
Actor=ServicePrincipalName,
Target=ResourceDisplayName,
Source=IPAddress,
Detail=strcat("Result=", tostring(ResultType))
),
(
OfficeActivity
| where TimeGenerated between (StartTime .. EndTime)
| where OfficeWorkload in ("SharePoint", "OneDrive")
| project TimeGenerated,
EvidenceType="Microsoft 365 activity",
Actor=tostring(UserId),
Target=Site_Url,
Source=ClientIP,
Detail=strcat(Operation, " | ", SourceFileName)
)
| order by TimeGenerated ascCorrelation requires a defensible key
Time proximity alone is useful but imperfect. Where available, strengthen the relationship with application IDs, service principal IDs, correlation identifiers, actor fields and resource details.
Now persistence can be assessed
If an unapproved application received meaningful permissions and subsequently authenticated as a service principal to relevant resources, the evidence for application-based persistence becomes substantially stronger.
Agent Foskett's application-access timeline
Your evidence board
| Evidence | What it supports | Weight |
|---|---|---|
| Successful service principal sign-in after consent | Shows the application authenticated to a resource after the grant. | Strong |
| Target resource matches granted permission purpose | Strengthens the relationship between consent and subsequent access. | Strong context |
| Workload activity correlated to application identity | Supports that the application performed actions after authentication. | Very strong when validated |
| No fresh interactive user sign-in | Supports non-interactive operation but does not prove the user had no active session. | Supporting context |
| Repeated application authentication | May support persistence rather than a one-off setup event. | Strong when unauthorised |
| Service principal sign-in alone | Does not prove specific organisational data was read or exfiltrated. | Insufficient alone |
Write the finding like an investigator
Example: Following the OAuth consent event identified in Lesson 154, Microsoft Entra service principal sign-in telemetry recorded successful non-interactive authentication by the associated application to Microsoft 365 resources. The application was tracked using its application identifier and reviewed by target resource, source IP, location, result and time. Microsoft 365 workload audit activity was then examined for corresponding application context, while the target user's interactive sign-in activity was reviewed separately. The sequence supports the conclusion that the application exercised granted access after consent and was capable of operating without a new interactive user sign-in. The evidence should not be overstated: service principal authentication alone does not prove which organisational data was accessed or whether data was exfiltrated. Workload-level activity and permission scope should be used to determine actual impact.
Lesson 155 key takeaways
- Use
AADServicePrincipalSignInLogsto investigate non-interactive application authentication. - Track applications by stable identifiers rather than display name alone.
- Identify the resources targeted by the service principal.
- A successful application sign-in does not by itself prove specific data access.
- Correlate identity telemetry with workload-level audit activity.
- Validate how application identity is represented in your Microsoft 365 audit schema.
- No new interactive user sign-in does not prove that no existing user session existed.
- Explicit service principal identity is stronger evidence of app-driven activity.
- Repeated unauthorised app authentication can strengthen a cloud-persistence finding.
- Separate authentication, resource access and exfiltration into distinct evidence questions.
Module 13 — the investigation moves into the mailbox
Lesson 154 found the consent grant. Lesson 155 shows how to test whether the application exercised that access. Next, the cloud investigation pivots into Exchange Online, where a new inbox rule appears after the suspicious sign-in.
Continue your KQL investigation training
Related Agent Foskett Investigations
🔎 KQL Academy — Module 13: Advanced Cloud & SaaS Investigation
Investigate service principal sign-ins with KQL
Lesson 155 of the Agent Foskett KQL Academy uses Microsoft Sentinel and Microsoft Entra service principal sign-in telemetry to investigate application access after OAuth consent.
Investigate non-interactive Microsoft 365 application access
Learn how to identify service principal authentication, determine which resources an application targeted, correlate identity and workload evidence and distinguish application access from interactive user activity.
