---
title: "Discussion on \"Hunting Impossible Travel in Sentinel with KQL\" | Hashnode"
description: "Discussion on \"Hunting Impossible Travel in Sentinel with KQL\". Two sign-ins too far apart in time and distance to be one person. In Sentinel, KQL's prev() and a distance function are all it takes."
url: "https://hashnode.com/posts/hunting-impossible-travel-kql/6aea28788273abae1e60d260"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Hunting Impossible Travel in Sentinel with KQL](https://alanconlon.hashnode.dev/hunting-impossible-travel-kql?utm_source=hashnode&utm_medium=feed)

Two sign-ins too far apart in time and distance to be one person. In Sentinel, KQL's prev() and a distance function are all it takes.

Nov 3 · 8 min read · alanconlon.hashnode.dev  
Read the article

-   [#kql](https://hashnode.com/tag/kql)
-   [#microsoft-sentinel](https://hashnode.com/tag/microsoft-sentinel)
-   [#cybersecurity](https://hashnode.com/tag/cybersecurity)
-   [#threat-hunting](https://hashnode.com/tag/threat-hunting)
-   [#identity](https://hashnode.com/tag/identity)

## Written by

[Alan Conlon](https://hashnode.com/@alanconlon)

@alanconlon · Ireland

  
[View profile](https://hashnode.com/@alanconlon)

Security engineer writing about Microsoft Sentinel, KQL, Entra ID and Power BI

Practical guides to Microsoft Sentinel, KQL threat hunting, Entra ID and Power BI, from over a decade in security engineering.

## Responses 3

Markdown supported · ⌘↵ to post

[Furqan Ashraf](https://hashnode.com/@jfreaks)

[Nov 12](https://hashnode.com/posts/hunting-impossible-travel-kql/6aea28788273abae1e60d260/comment/6af57b94b354e8da918b0262)

The honesty about VPNs is appreciated, because that's where this query lives or dies. One way to do the tuning without hand-maintaining egress ranges: classify the IPs instead of the users.

Add `IPAddress` to the projection and `PrevIP = prev(IPAddress)`, then join both ends of each pair against a lookup table with columns like `is_vpn`, `vpn_provider`, `is_corporate_gateway` and `is_cloud`. The decision gets more specific than a global exclusion:

-   either side is your own VPN or a known corporate gateway → suppress
-   either side is a commercial VPN → keep, lower severity, show the provider name in the alert
-   either side is a cloud/hosting IP → raise severity, since people rarely sign in to Entra from a VPS on purpose

The table can be a watchlist refreshed daily from whatever IP intelligence you have. We produce this kind of data at [IPGeolocation.io](https://ipgeolocation.io/documentation/ip-security-api.html) (I work there): the security endpoint returns those flags plus `vpn_last_seen`, and bulk takes up to 50,000 IPs per call, enough for a day of distinct sign-in IPs in most tenants. It's paid, so if budget is tight, start with your own egress list and named locations.

One catch either way: label the IP when the sign-in happens, not when the analyst opens the incident. VPN exits get reassigned, and next month's classification can be wrong for this week.

[Alan Conlon](https://hashnode.com/@alanconlon)

[Nov 13](https://hashnode.com/posts/hunting-impossible-travel-kql/6aea28788273abae1e60d260/comment/6af57b94b354e8da918b0262#reply-6af700cfcc91786c5668f2d5)

Thanks, that's a really good refinement. Classifying both ends of the pair rather than excluding users keeps the detection useful on VPN-heavy tenants, and putting the provider name in the alert makes triage much quicker. I should fold this into a future follow-up post.

[Furqan Ashraf](https://hashnode.com/@jfreaks)

[Nov 18](https://hashnode.com/posts/hunting-impossible-travel-kql/6aea28788273abae1e60d260/comment/6af57b94b354e8da918b0262#reply-6afd973f92457d9ac3d3fb8a)

Glad it was useful, Alan, and looking forward to the follow-up post. If you end up trying the IPGeolocation.io security endpoint for the watchlist, feel free to reach out. I'd be happy to help with the setup or the KQL join.
