← Back to SOC feed Coverage →

Non_intended_user_logon

kql MEDIUM Azure-Sentinel
DeviceLogonEventsIdentityInfo
huntingmicrosoftofficial
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-23T11:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may attempt to log on from unauthorized geographic locations to bypass access controls and gain unauthorized access to systems. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential credential theft or reconnaissance activities targeting specific regions.

KQL Query

let relevant_computers=
DeviceInfo
| where MachineGroup == "My_MachineGroup" 
| summarize make_list(DeviceName);
let relevant_users=
IdentityInfo
| where MailAddress endswith "@allowed.users"
| summarize make_list(AccountName);
DeviceLogonEvents
| where Timestamp > ago(1d)
| where DeviceName in (relevant_computers)
| where AccountName !in (relevant_users)
| project DeviceName, AccountName

Analytic Rule Definition

id: ef645ae9-da22-4ebe-b2ad-c3ad024b807c
name: Non_intended_user_logon
description: |
  Under some circumstances it is only allowed that users
  from country X logon to devices from country X.
  This query finds logon from users from other countries than X.
  The query requires a property to identify the users from
  country X. In this example a specific Email Address.
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - DeviceInfo
  - IdentityInfo
  - DeviceLogonEvents
query: |
  let relevant_computers=
  DeviceInfo
  | where MachineGroup == "My_MachineGroup" 
  | summarize make_list(DeviceName);
  let relevant_users=
  IdentityInfo
  | where MailAddress endswith "@allowed.users"
  | summarize make_list(AccountName);
  DeviceLogonEvents
  | where Timestamp > ago(1d)
  | where DeviceName in (relevant_computers)
  | where AccountName !in (relevant_users)
  | project DeviceName, AccountName

Required Data Sources

Sentinel TableNotes
DeviceLogonEventsEnsure this data connector is enabled
IdentityInfoEnsure this data connector is enabled

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/Initial access/Non_intended_user_logon.yaml