Sign-in & Login Problems

Fix AD FS Event ID 364 for Office 365 UPN Sign-Ins

John WilsonJohn Wilson Nov 25, 2026 868 views

Question details

Users need to sign in to federated Office 365 with their user principal names in a multi-forest environment.

Fix AD FS Event ID 364 for Office 365 UPN Sign-Ins
Product
Microsoft Office 365 and Active Directory Federation Services (AD FS)
Device & OS
not provided
Scenario
A federated Office 365 deployment uses multiple Active Directory forests, and users from one domain sign in with a UPN.
Observed behavior
Affected users receive an incorrect user ID or password error when using a UPN, while the domain\username format works. AD FS logs Event ID 364.
Before you start

Confirm the affected users' UPNs and identify the actual Active Directory forest or domain names used for lookup. On the AD FS server, review the Event ID 364 details and existing AD AUTHORITY claims provider trust settings before making changes.

Solution 1Recommended

Correct the AD FS Alternate Login ID and Lookup Forests

Use this approach when UPN sign-ins fail in a multi-forest deployment but domain\username sign-ins work.

The verified UPN suffix may differ from the actual forest or domain name that AD FS must query. Use the names that correspond to your environment rather than assuming the UPN suffix is the lookup name.

1
Inspect the current trust

On the AD FS server, open PowerShell with AD FS administrative privileges and run Get-AdfsClaimsProviderTrust | Where-Object { $_.Identifier -contains 'AD AUTHORITY' } | Format-List Name,Identifier,AlternateLoginID,LookupForests. Record the current values before changing them.

2
Set the login ID and lookup names

In the same PowerShell session, run Set-AdfsClaimsProviderTrust -TargetIdentifier "AD AUTHORITY" -AlternateLoginID userprincipalname -LookupForests domain2.com,domain1.local. Replace the example lookup names with the actual names for your environment.

3
Verify the configuration

Run Get-AdfsClaimsProviderTrust | Where-Object { $_.Identifier -contains 'AD AUTHORITY' } | Format-List AlternateLoginID,LookupForests and confirm that the displayed values match the intended configuration.

4
Test an affected sign-in

Open the federated Office 365 sign-in page and have an affected user sign in with their UPN. If it still fails, check the new AD FS Event ID 364 details in Event Viewer and investigate the reported error.

Correct the AD FS Alternate Login ID and Lookup Forests
Use environment-specific lookup names: The forest names in the command are examples. Changing the AD AUTHORITY trust affects authentication, so verify the intended names and configuration before applying the command.
Free Microsoft Office alternative

Work with Office Files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with Office files. Its format compatibility helps make migration straightforward, but it does not change or repair Microsoft AD FS authentication.

Open and edit Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXWork with documents, spreadsheets, and presentations in a familiar interfaceUse a lightweight office suite with free toolsContinue working with local Office files independently of an AD FS configuration change
microsoft office alternative - wps office

Frequently Asked Questions

Why can a user sign in with domain\username but not a UPN?

AD FS may be unable to resolve the UPN through its configured alternate login ID or lookup forests. Check AlternateLoginID and LookupForests on the AD AUTHORITY claims provider trust in PowerShell.

Should the lookup forest always match the user's UPN suffix?

No. A verified UPN suffix can differ from the actual forest or domain name used for lookup. Identify the relevant Active Directory names before setting LookupForests.

How do I check the existing AD FS lookup settings?

On the AD FS server, run Get-AdfsClaimsProviderTrust | Where-Object { $_.Identifier -contains 'AD AUTHORITY' } | Format-List AlternateLoginID,LookupForests in PowerShell.

What if Event ID 364 still appears after the change?

Retry the affected UPN sign-in, then open Event Viewer on the AD FS server and inspect the new Event ID 364 details. The event can have causes beyond the lookup configuration, so use its error details to guide further troubleshooting.