Named Locations and Blocking Countries in Conditional Access
Most small and mid-size tenants only ever sign in from a handful of countries, yet password spray and phishing traffic comes from everywhere. Named locations let Conditional Access tell your office networks apart from the rest of the internet and block countries you never do business in. This guide sets up both, report-only first.
Before you start
- Role: at least Conditional Access Administrator to create named locations and policies (How locations are defined (opens in a new tab)).
- License: Conditional Access needs Microsoft Entra ID P1 (see License requirements).
- Data: check the sign-in logs for the countries your users really sign in from, including travel and remote staff. See Investigate a sign-in.
- A way back in: working break-glass accounts, excluded from the policy (User exclusions (opens in a new tab)).
Step by step
- Add your office IP ranges. Go to Entra ID > Conditional Access > Named locations, choose an IP ranges location, name it, add your public ranges and optionally Mark as trusted location (Create a named location (opens in a new tab)). Use the public address your network uses to reach the internet, not internal addresses like 10.x (IP ranges (opens in a new tab)). IPv6 must be in CIDR notation (IP ranges (opens in a new tab)).
- Create a blocked-countries location. Choose a Countries location, add the countries to block, and decide whether to Include unknown countries/regions for IP addresses that don’t map to a country (Countries (opens in a new tab), Unknown countries (opens in a new tab)). Keep Determine location by IP address unless you have a specific reason for GPS.
- Create the block policy. In Conditional Access > Policies > New policy: include All users and exclude your break-glass accounts; target All resources; under Network set Configure to Yes and include Selected networks and locations with your blocked location; set Grant to Block access; and set Enable policy to Report-only (Create the policy (opens in a new tab)).
- Watch report-only. Review the Conditional Access tab in sign-in logs for at least the period your testing checklist calls for, then switch the policy to On (Create the policy (opens in a new tab)).
- Use trusted locations carefully. A policy can target All trusted networks and locations or exclude them (Trusted networks (opens in a new tab)), and sign-ins from trusted locations also improve ID Protection’s risk calculation (Trusted locations (opens in a new tab)). Don’t use a trusted location to skip MFA for everyone in the office.
Gotchas
- Conditional Access runs after first-factor authentication, so a country block doesn’t stop password attempts; it stops the sign-in from completing (Overview note (opens in a new tab)).
- Behind a cloud proxy or VPN, Microsoft Entra ID sees the proxy’s IP address, not the user’s; the X-Forwarded-For header isn’t used (Cloud proxy or VPN (opens in a new tab)).
- Location changes aren’t instant. Desktop and mobile apps using modern authentication are rechecked when they refresh tokens, by default about once an hour (When a location is evaluated (opens in a new tab)).
- GPS-based locations prompt users in Authenticator, can prompt every hour, and Microsoft says to use them only for very sensitive apps (Countries (opens in a new tab)).
- Limits: up to 195 IP-based named locations, 2,000 ranges per location, and CIDR masks greater than /8 (IP ranges (opens in a new tab)).
- The old MFA trusted IPs setting isn’t recommended and only accepts IPv4 (MFA trusted IPs (opens in a new tab)).
- Microsoft calls location blocks restrictive and says to test them thoroughly (When you might block locations (opens in a new tab)). Travelers get AADSTS53003; plan how they ask for an exception.
Check it worked
- Use the What If tool with a test user and an IP address from a blocked country; the block policy should apply.
- In the sign-in logs, report-only results show Report-only: Failure for sign-ins from blocked countries and nothing for your normal ones.
Roll back
Set the policy back to Report-only or Off. A deleted policy or named location can be restored within the 30-day soft-delete period (Restore deleted locations (opens in a new tab)). A location marked as trusted can’t be deleted until you remove the trusted flag (Trusted locations (opens in a new tab)).
Related on EntraReady: Conditional Access baseline, AADSTS53003 (blocked by Conditional Access), Common mistakes, and Break-glass accounts.
Sources (Microsoft Learn): Conditional Access: Network assignment (opens in a new tab), Block access by location (opens in a new tab).
← All GuidesIs this still accurate?
Spotted something outdated or wrong on this page? Tell us in a sentence. The page address is sent with it.