Azure Conditional Access Location

Published
Length
3 min read

Luis Felipe Dias

All posts

An azure conditional access location rule checks where a user logs in from. It matches the user IP or country against a list of trusted places. Teams set up these rules to block logins from outside the office. Still, broad network rules often give full trust to anyone on that network. Once a user passes the login check, their role lets them run anything. How an azure conditional access location rule works First, an admin defines named places inside the identity portal. These places use public

Conditional Access Policies + Azure RBAC: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

An azure conditional access location rule checks where a user logs in from. It matches the user IP or country against a list of trusted places. Teams set up these rules to block logins from outside the office. Still, broad network rules often give full trust to anyone on that network. Once a user passes the login check, their role lets them run anything.

How an azure conditional access location rule works

First, an admin defines named places inside the identity portal. These places use public IP ranges or country codes. You can mark specific IP ranges as trusted office networks. When a user tries to log in, the system reads their IP address. It compares that address against the named places in your rule.

For country rules, the system uses a map database to find the region. It checks both IPv4 and IPv6 addresses during the login step. If the place matches a blocked zone, the login stops right there. If the place is unknown, the rule can ask for a second factor. If the place is a trusted office IP, the user gets in fast.

Teams also pair these location rules with device checks. This ensures a user logs in from a known laptop in a safe country. The identity platform runs all these checks before it hands out a token. Once the token is live, the login flow is over.

Why location rules should be narrow

Many teams mark huge IP blocks as safe to avoid login prompts. If a whole cloud region counts as safe, attackers in that region win. Shared office networks can also hold guest laptops or compromised devices. When an IP range is too wide, the rule loses its value.

Wait times for IP map updates can also cause trouble for travelers. A new subnet might show up in the wrong country for weeks. Admins then widen the rule to fix the ticket fast. Over time, these wide exceptions weaken the whole login wall. You should keep trusted IP lists small and review them every month.

Conditional Access Policies + Azure RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What network rules solve and what they miss

Location checks are great at stopping random bots from distant countries. They cut down noise from basic password attacks right at the front door. They also help teams meet regional rules about where staff can work.

Yet a location rule only acts at the moment of login. It decides who gets a session token, not what happens inside that session. Once an engineer logs in from a safe IP, the check is done. The rule cannot see which database queries or shell commands they run next.

If an engineer runs a drop table command, the location rule stays silent. If a script pulls customer phone numbers or card numbers, the rule misses it. A stolen laptop inside the office passes the IP check with ease. Real safety needs controls that check every command and mask emails or national IDs in results.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev sits inline in the wire protocol beside those services as an open-source proxy, a sidecar for your Postgres or API. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How does Azure find a user location from an IP address?

The system checks the public IP address against a map database. It maps that IPv4 or IPv6 address to a specific country or region.

Can a VPN trick a location rule?

Yes, a user on a VPN shows the public IP of the VPN exit node. The rule sees the VPN server place instead of the real user place.

Does a location rule check commands after login?

No, the location rule only checks the user when they sign in or refresh tokens. It does not inspect database queries or server commands during the session.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.