Skip to main content

AADSTS51004: Selected directory does not contain the user

The selected directory does not contain the user.

What to check​

  1. Check the tenant selected by the app and whether the user or guest exists there.

Official reference​

Microsoft Learn: AADSTS error codes

Microsoft error lookup​

Message summary: The selected directory does not contain the user.

Fields in the message template: {identifier}, {tenant}.

Microsoft remediation: Check whether the app used the wrong tenant. If the user should have access, arrange a guest invitation.

Open AADSTS51004 in Microsoft’s lookup

Microsoft Learn: Add B2B collaboration users - Microsoft Entra External ID