← Back to SOC feed Coverage →

Risky Sign-in with Device Registration

kql MEDIUM Azure-Sentinel
CloudAppEvents
backdoorhuntingmicrosoftofficial
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-05-23T23:00:00Z · Confidence: medium

Hunt Hypothesis

A user may be attempting to compromise their account by registering a new device after a risky sign-in session, indicating potential credential theft or account takeover. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify and mitigate early-stage adversarial activity before further compromise occurs.

KQL Query

let registeredDevices=CloudAppEvents
| where ActionType =~ "Add registered owner to device."  
| where isnotempty(RawEventData.ObjectId) and isnotempty(RawEventData.ModifiedProperties[0].NewValue) and isnotempty(RawEventData.Target[1].ID) and isnotempty(RawEventData.ModifiedProperties[1].NewValue)
| where AccountDisplayName =~ "Device Registration Service" 
| extend AccountUpn = tostring(RawEventData.ObjectId) 
| extend AccountObjectId = tostring(RawEventData.Target[1].ID) 
| extend DeviceObjectId = tostring(RawEventData.ModifiedProperties[0].NewValue) 
| extend DeviceDisplayName = tostring(RawEventData.ModifiedProperties[1].NewValue) 
| project DeviceRegistrationTimestamp=Timestamp,ReportId,AccountUpn,AccountObjectId,DeviceObjectId,DeviceDisplayName; 
let registeringUser= 
registeredDevices 
| distinct AccountObjectId; 
let hasRegisteringUser = isnotempty(toscalar(registeringUser));
let riskySignins=EntraIdSignInEvents
| where hasRegisteringUser
| where AccountObjectId in (registeringUser) 
| where RiskLevelDuringSignIn in ("50","100") //Medium and High sign-in risk level. 
| where Application in ("Office 365 Exchange Online", "OfficeHome") 
| where isnotempty(SessionId) 
| project SignInTimestamp=Timestamp, Application, SessionId, AccountObjectId, IPAddress,RiskLevelDuringSignIn 
| summarize SignInTimestamp=argmin(SignInTimestamp,*) by Application,SessionId, AccountObjectId, IPAddress,RiskLevelDuringSignIn; 
registeredDevices 
| join riskySignins on AccountObjectId 
| where  DeviceRegistrationTimestamp - SignInTimestamp < 6h //Time delta between risky sign-in and device registration less than 6h 
| project-away AccountObjectId1

Analytic Rule Definition

id: ce2b03f8-92a4-4ec7-b55b-e9fa562fafa4
name: Risky Sign-in with Device Registration
description: |
  Looks for a new device registration in Entra ID preceded by medium or high-risk sign-in session for the same user within maximum 6h timeframe. 
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - CloudAppEvents
  - EntraIdSignInEvents
tactics:
- Persistence
query: |
  let registeredDevices=CloudAppEvents
  | where ActionType =~ "Add registered owner to device."  
  | where isnotempty(RawEventData.ObjectId) and isnotempty(RawEventData.ModifiedProperties[0].NewValue) and isnotempty(RawEventData.Target[1].ID) and isnotempty(RawEventData.ModifiedProperties[1].NewValue)
  | where AccountDisplayName =~ "Device Registration Service" 
  | extend AccountUpn = tostring(RawEventData.ObjectId) 
  | extend AccountObjectId = tostring(RawEventData.Target[1].ID) 
  | extend DeviceObjectId = tostring(RawEventData.ModifiedProperties[0].NewValue) 
  | extend DeviceDisplayName = tostring(RawEventData.ModifiedProperties[1].NewValue) 
  | project DeviceRegistrationTimestamp=Timestamp,ReportId,AccountUpn,AccountObjectId,DeviceObjectId,DeviceDisplayName; 
  let registeringUser= 
  registeredDevices 
  | distinct AccountObjectId; 
  let hasRegisteringUser = isnotempty(toscalar(registeringUser));
  let riskySignins=EntraIdSignInEvents
  | where hasRegisteringUser
  | where AccountObjectId in (registeringUser) 
  | where RiskLevelDuringSignIn in ("50","100") //Medium and High sign-in risk level. 
  | where Application in ("Office 365 Exchange Online", "OfficeHome") 
  | where isnotempty(SessionId) 
  | project SignInTimestamp=Timestamp, Application, SessionId, AccountObjectId, IPAddress,RiskLevelDuringSignIn 
  | summarize SignInTimestamp=argmin(SignInTimestamp,*) by Application,SessionId, AccountObjectId, IPAddress,RiskLevelDuringSignIn; 
  registeredDevices 
  | join riskySignins on AccountObjectId 
  | where  DeviceRegistrationTimestamp - SignInTimestamp < 6h //Time delta between risky sign-in and device registration less than 6h 
  | project-away AccountObjectId1

Required Data Sources

Sentinel TableNotes
CloudAppEventsEnsure this data connector is enabled

MITRE ATT&CK Context

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/Persistence/riskySignInToDeviceRegistration.yaml