Here's a sign-in pattern that should never happen. An account authenticates from Dublin at nine in the morning, then from São Paulo forty minutes later. Nobody crossed the Atlantic in forty minutes. So either the person is running a VPN that hops continents, or two different people are using one set of credentials, and one of them shouldn't be. That second case is what you're hunting.
Impossible travel is one of the classic identity detections, and Entra already flags a version of it as a risk signal. So why write your own? Because the built-in one is a black box that fires when Microsoft's model decides it should, and you can't see its workings or tune its thresholds. Building your own in KQL means you understand exactly what it checks, you can adjust it to your own tolerance, and you learn a couple of operators that are useful well beyond this one query.…