Cloud app activity for specific users – with device context
Shows everything a set of users did across Microsoft 365 and connected cloud apps, with IP, country, OS, device type and the managed/compliant flag. Useful for investigating a single user or checking where and from which kind of device someone works.
// === Parameters ===
let TargetUsers = dynamic(["<user-object-id-1>", "<user-object-id-2>"]); // Entra ID object IDs
let Lookback = 7d;
CloudAppEvents
| where Timestamp > ago(Lookback)
| where AccountObjectId in (TargetUsers)
| extend IsCompliantAndManaged = tostring(RawEventData.IsDeviceCompliantAndManaged)
| project Timestamp,
AccountDisplayName,
Application,
ActionType,
IPAddress,
CountryCode,
OSPlatform,
DeviceType,
IsCompliantAndManaged,
RawEventData // keep raw so you can inspect the device fields actually present
| order by Timestamp desc
