Conditional Access Problems

Restrict Microsoft 365 Access by IP Address with AD FS Claim Rules

Steven ParkerSteven Parker Nov 22, 2026 869 views

Question details

Restrict Microsoft 365 authentication to approved IP addresses, with an exception for members of a permitted Active Directory group.

Restrict Microsoft 365 Access by IP Address with AD FS Claim Rules
Product
Active Directory Federation Services (AD FS) and Microsoft 365
Device & OS
not provided
Scenario
An administrator wants to configure IP-based access restrictions and a group exception in the Microsoft 365 relying-party trust.
Observed behavior
The desired configuration permits authentication from approved IP addresses or by members of the permitted group, and denies other requests.
Before you start

Identify the Microsoft 365 relying-party trust, approved public IPv4 and IPv6 addresses, and the Active Directory group that will receive the exception. Check which client IP claim is available for each sign-in path, and test changes in a controlled environment with an emergency administrator access method.

Solution 1Recommended

Configure AD FS authorization rules for approved IPs and group members

Use the Microsoft 365 relying-party trust to deny requests that meet neither the approved-IP condition nor the group exception.

Use Microsoft’s AD FS claim-rule documentation to construct and validate the custom rules for your environment. IP claim availability and formatting can vary by protocol and proxy path; do not assume that every request contains a trustworthy end-user address.

Authorization rules must be able to evaluate the IP and group information available at the authorization stage. Do not rely on a claim produced only later by an issuance transform rule.

1
Open the relying-party trust

On an AD FS management server, open AD FS Management, select Relying Party Trusts, and locate the Microsoft 365 trust.

2
Inspect the authorization policy

Open the trust’s claim rules or access control policy settings. Check the existing authorization rules before adding a custom rule; the available options depend on the AD FS version.

3
Define the IP and group conditions

In the applicable authorization rule editor, use custom rules to evaluate the appropriate client IP claim and the permitted Active Directory group. Follow Microsoft’s claim-rule syntax for your IP claim’s actual format and for group membership checks.

4
Deny requests outside both exceptions

Add an authorization rule that denies a request only when its IP is not approved and the user is not a member of the permitted group. Account for missing or malformed IP claims, and avoid a blanket deny rule that would also block the exceptions.

5
Test each sign-in path

Test Microsoft 365 sign-ins from an approved IP, an unapproved IP with a permitted group member, and an unapproved IP with a nonmember. Review AD FS event logs and repeat for the relevant clients and authentication protocols.

Configure AD FS authorization rules for approved IPs and group members
Check the policy scope: These rules apply to authentication through the configured AD FS trust. They do not automatically cover sign-ins or access paths that bypass AD FS.
Free Microsoft Office alternative

Work with Microsoft Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface and compatibility with Microsoft Office file formats for an easier transition. It does not configure or replace AD FS or Microsoft 365 access policies.

Open and edit Word, Excel, and PowerPoint files in compatible Office formats.Continue working with office documents outside the Microsoft 365 sign-in workflow.Use a familiar interface that makes migration easier.Get a free, lightweight office suite.
microsoft office alternative - wps office

Frequently Asked Questions

Can an allowed group member sign in from an unapproved IP address?

Yes, if the AD FS authorization logic treats membership in the permitted group as an exception. Test both a member and a nonmember from an unapproved IP before deployment.

Which IP claim should I use in the AD FS rule?

Inspect the claims available for each relevant sign-in path and use the client IP claim documented for that path. Proxy and protocol behavior can affect both the value and its trustworthiness.

What happens if a request has no client IP claim?

Define and test an explicit policy for missing or malformed IP values. If the intent is to fail closed, a request without an approved IP should be denied unless the user qualifies for the group exception.

Do AD FS rules restrict every Microsoft 365 sign-in?

No. Rules on the Microsoft 365 relying-party trust govern authentication through that AD FS trust. Review other sign-in paths and consider Microsoft Entra Conditional Access where broader cloud policy coverage is needed.