Access to Microsoft 365 is a key part of the day-to-day operations of many organizations. Unfortunately, the development of cybercriminal capabilities has rendered that role a potential vulnerability, with vital data held outside your immediate network.
Threat actors can turn these external access pathways against your organization, even while using additional security measures like multi-factor authentication to steal credentials. It’s important that those access conditions are clearly defined and enforced with a granular Zero Trust approach.
This guide explains how you can do just that with ThreatLocker, restricting Microsoft 365 access so users can sign in only from a specific public IP address by creating a named location and enforcing it with a Conditional Access policy.
Prerequisites
Before you begin, ensure you have the following:
- Microsoft Entra ID (Azure AD) Premium P1 or P2 license
- Global Administrator or Conditional Access Administrator permissions
- The public IP address you want to allow access from (example: 10.1.1.1)
Step 1: Create a named location
- Sign in to the Microsoft Entra Admin Center:
- Navigate to:
- Protection → Conditional Access → Named locations
- Select + IP ranges location
- Configure the location:
- Name: Allowed Office Location
- IP ranges: 10.1.1.1
- Check Mark as trusted location
- This is optional but recommended
- Select Create
The named location will now represent the trusted IP address.
Step 2: Create a Conditional Access Policy
- In the Microsoft Entra Admin Center, go to:
Protection → Conditional Access → Policies - Select + New policy
- Enter a Policy Name:
- Restrict Microsoft 365 Access to Approved IP
Step 3: Configure Users or Groups
- Navigate to Assignments → Users
- Select the users or groups that should be restricted.
- Recommended options:
- All users (recommended for full enforcement)
- Specific user groups
- Recommended options:
Tip: Exclude at least one emergency admin account to avoid accidental lockout.
Step 4: Select target applications
- Under Assignments → Target resources
- Select All cloud apps
This ensures the policy applies to all Microsoft 365 services.
Step 5: Configure location conditions
- Under Conditions → Locations
- Set Configure to Yes
- Under Include
- Select Any location
- Under Exclude
- Select Selected locations
- Choose the Named Location created earlier (Allowed Office Location)
This configuration means:
- Any login not from the allowed IP will trigger the policy.
Step 6: Configure access controls
- Go to Access controls → Grant
- Select:
- Block access
- Choose Select
This blocks sign-ins from any location that is not the trusted IP address.
Step 7: Enable the policy
- Under Enable policy, choose:
- On (or Report-only for testing)
- Select Create
Help Center