Why this matters
Privileged account misuse and suspicious elevated process execution can be important signals during an endpoint investigation. Legitimate administrators also use elevation routinely, so treating every RunAs event as credential theft can lead to false positives or inappropriate containment.
This guide shows how to correlate RunAs process creation, token elevation and logon evidence in Defender XDR to identify activity requiring further investigation without overstating what the telemetry proves.
What you'll accomplish
Find RunAs process creation, inspect token elevation and corroborate the account and device logon context.
Before you begin
- Advanced Hunting permission and onboarded Windows endpoints
- Appropriate retention and a test or approved investigation window
- Availability of DeviceProcessEvents and DeviceLogonEvents telemetry
Verify the result: Reproduce benign RunAs and UAC scenarios on a test host, compare process and logon telemetry and eliminate expected service execution.
Understand the different elevation signals
Windows RunAs execution, process token elevation and successful logon events describe different behaviours. Use Defender XDR Advanced Hunting to collect each signal and correlate them without assuming that every elevated process indicates stolen credentials.
It is important not to collapse distinct behaviors: a command line containing runas.exe, a process with an elevated token and a second interactive logon can have different explanations.
Step 1 — Hunt for runas.exe process creation
This query looks for the runas.exe executable in process creation telemetry. A process named RunAs is only a starting point; confirm that it is the legitimate Windows binary and examine its parent and account context.
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName =~ "runas.exe"
| project Timestamp, DeviceId, DeviceName,
AccountDomain, AccountName, AccountSid,
FileName, FolderPath, ProcessCommandLine,
ProcessId, ProcessCreationTime,
InitiatingProcessFileName, InitiatingProcessCommandLine,
InitiatingProcessAccountName
| order by Timestamp descA search on ProcessCommandLine contains "runas" may find additional scripts or arguments, but can also capture entirely unrelated strings. Use exact executable and command structure where possible.
Step 2 — Inspect full-token elevation
DeviceProcessEvents
| where Timestamp > ago(7d)
| where ProcessTokenElevation contains "Full"
| project Timestamp, DeviceId, DeviceName,
FileName, ProcessCommandLine,
AccountDomain, AccountName,
ProcessTokenElevation,
InitiatingProcessFileName,
InitiatingProcessAccountName
| take 200Inspect the actual values present in ProcessTokenElevation in your tenant. This query demonstrates a filter, not a claim that all fully elevated processes came from RunAs. Service processes and normal administrative workflows may have elevated tokens.
Step 3 — Correlate with logon events
DeviceLogonEvents
| where Timestamp > ago(7d)
| where ActionType =~ "LogonSuccess"
| project Timestamp, DeviceId, DeviceName,
AccountDomain, AccountName, LogonType,
RemoteIP, RemoteDeviceName
| order by Timestamp descJoin on device and a bounded time window only after verifying the event semantics. An event near a RunAs process does not automatically establish causation. Process IDs are reused; include ProcessCreationTime, account identifiers and any available unique process keys when correlating.
For Microsoft Sentinel collecting Windows security events, Event IDs 4688 and 4624 can be useful, but the security audit policy, event schema and device coverage are different from Defender hunting tables. Do not paste Defender table names into a workspace that has not ingested those data streams.
Step 4 — Validate results and tune false positives
Test an approved normal RunAs invocation, an administrative elevation through User Account Control and a scheduled task run as a service account. Compare the results. Document which behaviors appear in which tables and the false-positive sources in the organisation. Avoid logging credentials in command lines or examples.