Skip to content
medium severityMicrosoft Sentinel

Impossible travel sign-ins in Entra ID (KQL)

This SigninLogs query flags accounts that signed in successfully from more than one country inside a short window. It parses the country from LocationDetails, groups successful sign-ins per user and hour, and keeps users whose set of countries has more than one entry.

It is a deliberately simple, transparent alternative to risk-based impossible-travel detections: you can read exactly why a user was flagged, tune the window, and run it over historical data without a premium licence.

The query

SigninLogs
| where TimeGenerated > ago(24h)
| where ResultType == "0"                 // successful sign-ins only
| extend Country = tostring(LocationDetails.countryOrRegion)
| where isnotempty(Country)
| summarize
    Countries = make_set(Country),
    Cities = make_set(tostring(LocationDetails.city), 20),
    IPs = make_set(IPAddress, 50),
    SignIns = count()
    by UserPrincipalName, bin(TimeGenerated, 1h)
| where array_length(Countries) > 1
| sort by UserPrincipalName asc

Line-by-line explanation

  • | where ResultType == "0"

    Only successful sign-ins matter here — a failure from another country is not travel, it is a spray or a typo.

  • | extend Country = tostring(LocationDetails.countryOrRegion)

    LocationDetails is a dynamic column; countryOrRegion is extracted and cast to a string so it can be collected into a set.

  • | where array_length(Countries) > 1

    Keeps only users whose successful sign-ins in the hour span more than one country — the impossible-travel condition.

Required tables and columns

  • ResultTypeSign-in result code; 0 is a successful sign-in.
  • LocationDetailsDynamic object with countryOrRegion, city and geo-coordinates of the sign-in.
  • UserPrincipalNameThe signing-in account, grouped to compare its locations over time.
  • IPAddressSource IP, collected so an analyst can triage each location quickly.

MITRE ATT&CK mapping

Tuning and false positives

  • Exclude VPN and corporate egress ranges whose geo-IP resolves to a different country than the user, a common benign cause.
  • Allow-list neighbouring countries for border commuters, or users who legitimately travel, to cut noise.
  • Narrow bin() to 30m to approximate travel speed more closely, at the cost of missing slower hops.

Limitations

  • Geo-IP is approximate; cloud VPNs, mobile carriers and anonymisers routinely place a user in the wrong country and cause false positives.
  • It does not compute real distance or speed, so two genuinely reachable countries in an hour still flag. Treat it as triage, not proof.

References

Last reviewed 2026-11-18.