Entra ID Register Device with Unusual User Agent
Detects successful, user-initiated Microsoft Entra ID audit events for Register device where additional details indicate an Azure AD join or Azure AD register and the recorded user agent is not one of the common native registration clients (Dsreg, DeviceRegistrationClient, or Dalvik-based Android enrollment). Legitimate Windows and standard mobile enrollment flows present predictable user-agent strings; unexpected clients such as axios, node, python-requests, or offensive tooling like GraphSpy and ROADtools may reflect scripted or adversary-driven device registration used to obtain a Primary Refresh Token for persistence or token abuse. Registrations performed by service principals or the Device Registration Service itself (for example Windows 365 Cloud PC pre-authorized joins) and Microsoft-owned EvoSTS authorization checks are excluded. Baseline approved provisioning tools and MDM integrations before tuning.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2026/05/15"
3integration = ["azure"]
4maturity = "production"
5updated_date = "2026/10/26"
6
7[rule]
8author = ["Elastic"]
9description = """
10Detects successful, user-initiated Microsoft Entra ID audit events for Register device where additional details indicate
11an Azure AD join or Azure AD register and the recorded user agent is not one of the common native registration clients
12(Dsreg, DeviceRegistrationClient, or Dalvik-based Android enrollment). Legitimate Windows and standard mobile enrollment
13flows present predictable user-agent strings; unexpected clients such as axios, node, python-requests, or offensive
14tooling like GraphSpy and ROADtools may reflect scripted or adversary-driven device registration used to obtain a
15Primary Refresh Token for persistence or token abuse. Registrations performed by service principals or the Device
16Registration Service itself (for example Windows 365 Cloud PC pre-authorized joins) and Microsoft-owned EvoSTS
17authorization checks are excluded. Baseline approved provisioning tools and MDM integrations before tuning.
18"""
19false_positives = [
20 """
21 Custom device management agents, OEM enrollment clients, Linux Intune enrollment, or updated Microsoft clients that
22 use new user-agent strings may match. Add exclusions for known `azure.auditlogs.properties.userAgent` values or
23 enrollment programs after review.
24 """,
25]
26from = "now-9m"
27index = ["logs-azure.auditlogs-*"]
28language = "kuery"
29license = "Elastic License v2"
30name = "Entra ID Register Device with Unusual User Agent"
31note = """## Triage and analysis
32
33### Investigating Entra ID Register Device with Unusual User Agent
34
35Review `azure.auditlogs.properties.initiated_by.user.userPrincipalName`, source IP fields on the audit event,
36`azure.auditlogs.properties.target_resources.0.display_name` for the device name, and
37`azure.correlation_id` for related audit entries.
38
39Compare `azure.auditlogs.properties.userAgent` to your organization's standard Autopilot, Intune, and Windows enrollment
40clients. The rule matches both `Azure AD join` and `Azure AD register` (BYOD) trust types, and only user-initiated
41registrations (`azure.auditlogs.properties.initiated_by.user.id` is populated).
42
43### Possible investigation steps
44
45- Confirm whether the user intentionally joined a device and whether the user agent matches a known provisioning package.
46- Pivot to `azure.signinlogs` for the same principal and timeframe for risky sign-ins or token broker activity.
47- Search for other `Register device` events from the same IP or user agent across the tenant.
48- Treat scripted clients (`axios/*`, `node`, `python-requests/*`) and offensive-tool device names (for example `GraphSpy-Device`, `DESKTOP-*` with a non-Dsreg user agent) as high-fidelity suspicious, especially from hosting ASNs.
49- Check for a preceding Microsoft Authentication Broker sign-in to the Device Registration Service and a follow-on `primaryRefreshToken` sign-in from an unmanaged device.
50
51### False positive analysis
52
53- Linux Intune and other third-party enrollment clients can present unfamiliar user agents. Validate against device inventory and add narrow exceptions on the user agent.
54- Service-initiated registrations (Windows 365 Cloud PC pre-authorized joins, Autopilot) have no initiating user and are excluded by the rule.
55- Microsoft-owned `EvoSTS` authorization checks from Microsoft ASN 8075 are excluded; the exclusion is bound to the ASN so a spoofed user agent from other infrastructure still alerts.
56
57### Response and remediation
58
59- If malicious, remove the device in Entra ID, revoke refresh and primary refresh tokens for the user, and reset credentials per policy.
60- Tighten device registration and join controls via Conditional Access and device compliance policies.
61"""
62references = [
63 "https://learn.microsoft.com/en-us/entra/identity/devices/concept-directory-join",
64 "https://github.com/dirkjanm/ROADtools",
65 "https://www.huntress.com/blog/token-replay-spray",
66 "https://www.elastic.co/security-labs/tycoon-2fa-aitm-detection-engineering",
67]
68risk_score = 47
69rule_id = "d4695889-0410-4e7b-a4aa-59be525a11a6"
70severity = "medium"
71tags = [
72 "Domain: Cloud",
73 "Domain: Identity",
74 "Data Source: Azure",
75 "Data Source: Microsoft Entra ID",
76 "Data Source: Microsoft Entra ID Audit Logs",
77 "Use Case: Threat Detection",
78 "Tactic: Persistence",
79 "Resources: Investigation Guide",
80 "Noise: Low",
81 "Performance: Normal",
82 "Rule Type: Custom Query (KQL)",
83 "Platform: Entra ID",
84]
85timestamp_override = "event.ingested"
86type = "query"
87query = '''
88data_stream.dataset:"azure.auditlogs" and event.action:"Register device" and
89event.outcome:(success or Success) and
90azure.auditlogs.properties.initiated_by.user.id:* and
91azure.auditlogs.properties.userAgent:(* and not (Dsreg* or DeviceRegistrationClient or Dalvik*)) and
92azure.auditlogs.properties.additional_details.value:("Azure AD join" or "Azure AD register") and
93not (azure.auditlogs.properties.userAgent:EvoSTS and source.as.number:8075)
94'''
95
96[rule.investigation_fields]
97field_names = [
98 "@timestamp",
99 "event.action",
100 "event.outcome",
101 "azure.auditlogs.properties.userAgent",
102 "azure.auditlogs.properties.additional_details.value",
103 "azure.auditlogs.properties.initiated_by.user.userPrincipalName",
104 "azure.auditlogs.properties.initiated_by.user.ipAddress",
105 "azure.auditlogs.properties.target_resources.0.display_name",
106 "azure.auditlogs.properties.target_resources.0.id",
107 "azure.correlation_id",
108]
109
110[[rule.threat]]
111framework = "MITRE ATT&CK"
112
113[[rule.threat.technique]]
114id = "T1098"
115name = "Account Manipulation"
116reference = "https://attack.mitre.org/techniques/T1098/"
117
118[[rule.threat.technique.subtechnique]]
119id = "T1098.005"
120name = "Device Registration"
121reference = "https://attack.mitre.org/techniques/T1098/005/"
122
123[rule.threat.tactic]
124id = "TA0003"
125name = "Persistence"
126reference = "https://attack.mitre.org/tactics/TA0003/"
Triage and analysis
Investigating Entra ID Register Device with Unusual User Agent
Review azure.auditlogs.properties.initiated_by.user.userPrincipalName, source IP fields on the audit event,
azure.auditlogs.properties.target_resources.0.display_name for the device name, and
azure.correlation_id for related audit entries.
Compare azure.auditlogs.properties.userAgent to your organization's standard Autopilot, Intune, and Windows enrollment
clients. The rule matches both Azure AD join and Azure AD register (BYOD) trust types, and only user-initiated
registrations (azure.auditlogs.properties.initiated_by.user.id is populated).
Possible investigation steps
- Confirm whether the user intentionally joined a device and whether the user agent matches a known provisioning package.
- Pivot to
azure.signinlogsfor the same principal and timeframe for risky sign-ins or token broker activity. - Search for other
Register deviceevents from the same IP or user agent across the tenant. - Treat scripted clients (
axios/*,node,python-requests/*) and offensive-tool device names (for exampleGraphSpy-Device,DESKTOP-*with a non-Dsreg user agent) as high-fidelity suspicious, especially from hosting ASNs. - Check for a preceding Microsoft Authentication Broker sign-in to the Device Registration Service and a follow-on
primaryRefreshTokensign-in from an unmanaged device.
False positive analysis
- Linux Intune and other third-party enrollment clients can present unfamiliar user agents. Validate against device inventory and add narrow exceptions on the user agent.
- Service-initiated registrations (Windows 365 Cloud PC pre-authorized joins, Autopilot) have no initiating user and are excluded by the rule.
- Microsoft-owned
EvoSTSauthorization checks from Microsoft ASN 8075 are excluded; the exclusion is bound to the ASN so a spoofed user agent from other infrastructure still alerts.
Response and remediation
- If malicious, remove the device in Entra ID, revoke refresh and primary refresh tokens for the user, and reset credentials per policy.
- Tighten device registration and join controls via Conditional Access and device compliance policies.
References
Related rules
- Entra ID Device Registration with ROADtools Default OS Build
- Entra ID Global Administrator Role Assigned
- Entra ID Device Registration with Phishing Kit Default OS Build
- Entra ID Domain Federation Configuration Change
- Entra ID Microsoft Authentication Broker DRS Sign-In from Suspicious ASN