Entra ID User Sign-in with Unusual Non-Managed Device
Identifies when a Microsoft Entra ID user signs in from a device that is not typically used by the user and is not managed, which may indicate potential compromise or unauthorized access attempts. This rule detects unusual sign-in activity by comparing the device used for the sign-in against the user's typical device usage patterns. Adversaries may create and register a new device to obtain a Primary Refresh Token (PRT) and maintain persistent access.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2025/06/16"
3integration = ["azure"]
4maturity = "production"
5updated_date = "2026/09/18"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies when a Microsoft Entra ID user signs in from a device that is not typically used by the user and is not managed, which may
11indicate potential compromise or unauthorized access attempts. This rule detects unusual sign-in activity by comparing
12the device used for the sign-in against the user's typical device usage patterns. Adversaries may create and register a
13new device to obtain a Primary Refresh Token (PRT) and maintain persistent access.
14"""
15from = "now-9m"
16index = ["filebeat-*", "logs-azure.signinlogs-*"]
17language = "kuery"
18license = "Elastic License v2"
19name = "Entra ID User Sign-in with Unusual Non-Managed Device"
20note = """## Triage and analysis
21
22### Investigating Entra ID User Sign-in with Unusual Non-Managed Device
23
24This rule detects when a Microsoft Entra ID user signs in from a device that is not typically used by the user, which may indicate potential compromise or unauthorized access attempts. This rule detects unusual sign-in activity by comparing the device used for the sign-in against the user's typical device usage patterns. Adversaries may create and register a new device to obtain a Primary Refresh Token (PRT) and maintain persistent access.
25
26### Possible investigation steps
27- Review the `azure.signinlogs.properties.user_principal_name` field to identify the user associated with the sign-in.
28- Check the `azure.signinlogs.properties.device_detail.device_id` field to identify the device used for the sign-in.
29- Review `azure.signinlogs.properties.incoming_token_type` to determine what tpe of security token was used for the sign-in, such as a Primary Refresh Token (PRT).
30- Examine `azure.signinlogs.category` to determine if these were non-interactive or interactive sign-ins.
31- Check the geolocation of the sign-in by reviewing `source.geo.country_name` and `source.geo.city_name` to identify the location of the device used for the sign-in. If these are unusual for the user, it may indicate a potential compromise.
32- Review `azure.signinlogs.properties.app_id` to determine which client application was used for the sign-in. If the application is not recognized or expected, it may indicate unauthorized access. Adversaries use first-party client IDs to blend in with legitimate traffic.
33- Examine `azure.signinlogs.properties.resource_id` to determine what resource the security token has in scope and/or is requesting access to. If the resource is not recognized or expected, it may indicate unauthorized access. Excessive access to Graph API is common post-compromise behavior.
34- Review the identity protection risk status by checking `azure.signinlogs.properties.risk_level` and `azure.signinlogs.properties.risk_detail` to determine if the sign-in was flagged as risky by Entra ID Protection.
35
36### False positive analysis
37- Legitimate users may sign in from new devices, such as when using a new laptop or mobile device. If this is expected behavior, consider adjusting the rule or adding exceptions for specific users or device IDs.
38- Environments where users frequently change devices, such as in a corporate setting with rotating hardware, may generate false positives.
39- Users may use both an endpoint and mobile device for sign-ins, which could trigger this rule.
40- Hybrid Azure AD joined devices often report `is_managed: false` when Intune MDM is not enrolled; that corporate hybrid-join state is excluded. Azure AD joined devices are kept in scope because OAuth phishing / ROADtx device registration commonly creates cloud-joined (not hybrid) unmanaged devices.
41- Non-interactive sign-ins with `azure.signinlogs.properties.incoming_token_type` of `"none"` (common Microsoft first-party background token acquisition on registered devices) are excluded; `"primaryRefreshToken"` (PRT) and `"refreshToken"` activity remain in scope.
42
43### Response and remediation
44- If the sign-in is confirmed to be suspicious or unauthorized, take immediate action to revoke the access token and prevent further access.
45- Disable the user account temporarily to prevent any potential compromise or unauthorized access.
46- Review the user's recent sign-in activity and access patterns to identify any potential compromise or unauthorized access.
47- If the user account is compromised, initiate a password reset and enforce multi-factor authentication (MFA) for the user.
48- Review the conditional access policies in place to ensure they are sufficient to prevent unauthorized access to sensitive resources.
49- Identify the registered Entra ID device by reviewing `azure.signinlogs.properties.device_detail.display_name` and confirm it is expected for the user or organization. If it is not expected, consider removing the device registration.
50- Consider adding exceptions for verified devices that are known to be used by the user to reduce false-positives.
51"""
52references = [
53 "https://pushsecurity.com/blog/consentfix",
54 "https://www.volexity.com/blog/2025/04/22/phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows/",
55 "https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/",
56]
57risk_score = 21
58rule_id = "72c91fc0-4ac0-11f0-811f-f661ea17fbcd"
59setup = """#### Required Microsoft Entra ID Sign-In Logs
60This rule requires the Azure integration with Microsoft Entra ID Sign-In logs to be enabled and configured to collect audit and activity logs via Azure Event Hub.
61"""
62severity = "low"
63tags = [
64 "Domain: Cloud",
65 "Domain: Identity",
66 "Use Case: Threat Detection",
67 "Tactic: Persistence",
68 "Data Source: Azure",
69 "Data Source: Microsoft Entra ID",
70 "Data Source: Microsoft Entra ID Sign-In Logs",
71 "Platform: Entra ID",
72 "Resources: Investigation Guide",
73 "Noise: Medium",
74 "Performance: Normal",
75 "Rule Type: New Terms",
76]
77timestamp_override = "event.ingested"
78type = "new_terms"
79
80query = '''
81data_stream.dataset: "azure.signinlogs" and
82 event.category: "authentication" and
83 azure.signinlogs.properties.user_type: "Member" and
84 azure.signinlogs.properties.token_protection_status_details.sign_in_session_status: "unbound" and
85 not azure.signinlogs.properties.device_detail.is_managed: true and
86 not azure.signinlogs.properties.device_detail.device_id: "" and
87 not azure.signinlogs.properties.device_detail.trust_type: "Hybrid Azure AD joined" and
88 not (azure.signinlogs.category: "NonInteractiveUserSignInLogs" and azure.signinlogs.properties.incoming_token_type: "none") and
89 azure.signinlogs.properties.user_principal_name: *
90'''
91
92
93[[rule.threat]]
94framework = "MITRE ATT&CK"
95
96[[rule.threat.technique]]
97id = "T1098"
98name = "Account Manipulation"
99reference = "https://attack.mitre.org/techniques/T1098/"
100
101[[rule.threat.technique.subtechnique]]
102id = "T1098.005"
103name = "Device Registration"
104reference = "https://attack.mitre.org/techniques/T1098/005/"
105
106[rule.threat.tactic]
107id = "TA0003"
108name = "Persistence"
109reference = "https://attack.mitre.org/tactics/TA0003/"
110
111[[rule.threat]]
112framework = "MITRE ATT&CK"
113
114[[rule.threat.technique]]
115id = "T1078"
116name = "Valid Accounts"
117reference = "https://attack.mitre.org/techniques/T1078/"
118
119[[rule.threat.technique.subtechnique]]
120id = "T1078.004"
121name = "Cloud Accounts"
122reference = "https://attack.mitre.org/techniques/T1078/004/"
123
124[rule.threat.tactic]
125id = "TA0001"
126name = "Initial Access"
127reference = "https://attack.mitre.org/tactics/TA0001/"
128
129[rule.investigation_fields]
130field_names = [
131 "azure.signinlogs.properties.user_principal_name",
132 "azure.signinlogs.properties.device_detail.device_id",
133 "azure.signinlogs.properties.incoming_token_type",
134 "azure.signinlogs.category",
135 "source.geo.country_name",
136 "source.geo.city_name",
137 "source.address",
138 "azure.signinlogs.properties.app_id",
139 "azure.signinlogs.properties.resource_id",
140 "azure.signinlogs.properties.risk_level",
141 "azure.signinlogs.properties.risk_detail",
142]
143
144[rule.new_terms]
145field = "new_terms_fields"
146value = [
147 "azure.signinlogs.properties.user_principal_name",
148 "azure.signinlogs.properties.device_detail.device_id",
149]
150[[rule.new_terms.history_window_start]]
151field = "history_window_start"
152value = "now-7d"
Triage and analysis
Investigating Entra ID User Sign-in with Unusual Non-Managed Device
This rule detects when a Microsoft Entra ID user signs in from a device that is not typically used by the user, which may indicate potential compromise or unauthorized access attempts. This rule detects unusual sign-in activity by comparing the device used for the sign-in against the user's typical device usage patterns. Adversaries may create and register a new device to obtain a Primary Refresh Token (PRT) and maintain persistent access.
Possible investigation steps
- Review the
azure.signinlogs.properties.user_principal_namefield to identify the user associated with the sign-in. - Check the
azure.signinlogs.properties.device_detail.device_idfield to identify the device used for the sign-in. - Review
azure.signinlogs.properties.incoming_token_typeto determine what tpe of security token was used for the sign-in, such as a Primary Refresh Token (PRT). - Examine
azure.signinlogs.categoryto determine if these were non-interactive or interactive sign-ins. - Check the geolocation of the sign-in by reviewing
source.geo.country_nameandsource.geo.city_nameto identify the location of the device used for the sign-in. If these are unusual for the user, it may indicate a potential compromise. - Review
azure.signinlogs.properties.app_idto determine which client application was used for the sign-in. If the application is not recognized or expected, it may indicate unauthorized access. Adversaries use first-party client IDs to blend in with legitimate traffic. - Examine
azure.signinlogs.properties.resource_idto determine what resource the security token has in scope and/or is requesting access to. If the resource is not recognized or expected, it may indicate unauthorized access. Excessive access to Graph API is common post-compromise behavior. - Review the identity protection risk status by checking
azure.signinlogs.properties.risk_levelandazure.signinlogs.properties.risk_detailto determine if the sign-in was flagged as risky by Entra ID Protection.
False positive analysis
- Legitimate users may sign in from new devices, such as when using a new laptop or mobile device. If this is expected behavior, consider adjusting the rule or adding exceptions for specific users or device IDs.
- Environments where users frequently change devices, such as in a corporate setting with rotating hardware, may generate false positives.
- Users may use both an endpoint and mobile device for sign-ins, which could trigger this rule.
- Hybrid Azure AD joined devices often report
is_managed: falsewhen Intune MDM is not enrolled; that corporate hybrid-join state is excluded. Azure AD joined devices are kept in scope because OAuth phishing / ROADtx device registration commonly creates cloud-joined (not hybrid) unmanaged devices. - Non-interactive sign-ins with
azure.signinlogs.properties.incoming_token_typeof"none"(common Microsoft first-party background token acquisition on registered devices) are excluded;"primaryRefreshToken"(PRT) and"refreshToken"activity remain in scope.
Response and remediation
- If the sign-in is confirmed to be suspicious or unauthorized, take immediate action to revoke the access token and prevent further access.
- Disable the user account temporarily to prevent any potential compromise or unauthorized access.
- Review the user's recent sign-in activity and access patterns to identify any potential compromise or unauthorized access.
- If the user account is compromised, initiate a password reset and enforce multi-factor authentication (MFA) for the user.
- Review the conditional access policies in place to ensure they are sufficient to prevent unauthorized access to sensitive resources.
- Identify the registered Entra ID device by reviewing
azure.signinlogs.properties.device_detail.display_nameand confirm it is expected for the user or organization. If it is not expected, consider removing the device registration. - Consider adding exceptions for verified devices that are known to be used by the user to reduce false-positives.
References
Related rules
- Entra ID OAuth user_impersonation Scope for Unusual User and Client
- Entra ID Service Principal with Unusual Source ASN
- Entra ID AiTM Phishing-Kit Chain Detected
- Entra ID Conditional Access MFA Bypass with Unusual User, Client and Source ASN
- Entra ID Microsoft Authentication Broker DRS Sign-In from Suspicious ASN