In this article, we will see how to fix Office 365 error AADSTS51004, The user account does not exist in the directory. The error shows up when a user tries to log in to Office 365, cloud-based corporate applications, or any Office 365 desktop program. The error pops up on the first attempt, but when you refresh the page, you will get a detailed error report. The second report has a copy-paste option; you can send it to the administrator for action.
The AADSTS51004 Office 365 error shows that the user used the correct credentials to sign in, and was able to authenticate successfully. But, the user might be deleted, or the account hasn’t synced yet, among other reasons. The error message looks like this:
AADSTS51004: The user account does not exist in the directory. To sign into this application, the account must be added to the directory.
What is the AADSTS51004 error?
The AADSTS51004 is an error message code that happens when a user account does not exist in a specific directory, such as Microsoft Azure Active Directory (AD). To access the application, the user account must be added to the AD as a guest or as an independent domain. The error is triggered when the user account lacks the ImmutableID in Office 365 apps.
What causes AADSTS51004 Office 365 error?
There are several reasons why you get the AADSTS51004 error; the list below these causes;
- Incorrect account type. If a user is trying to sign in using their personal accounts in multitenant accounts, they will get the error.
- The guest user wasn’t invited. A user may get the error when they are trying to access an account that they were not invited by the administrator.
- Admin deleted the account. The admin may have removed an account from the directory. If a user tried to recreate such an account they will get the error AADSTS51004.
Fix AADSTS51004 Office 365 error
If you get error AADSTS51004, The user account does not exist in the directory in any Microsoft 365 applications, try the following solutions:
- Remove and Re-add user account
- Add the user as a guest
- Use the right account credentials
Let us look at these two solutions one by one in detail.
1] Remove and Re-add user account
The AADSTS51004 error may occur because the user accounts in the AD or Office 365 app have not synced properly. The solution to this is to remove the user account in the AD Connect server and re-add it to sync again. Use the following steps:
- Go to the Azure Admin center, click on Settings, and then the Domains page.
- Select the domain account you want to change, and on the left side, click Delete.
- Next, follow the prompts and directions to continue with the process. Finally, click Close to complete the process.
NOTE: To perform the above step, you must have administrative privileges to make such changes in AD.
For Office 365 app, go to the login page, sign out, and then sign in again to allow syncing to restart.
Related: Office Error CAA50021, Number of retry attempts exceeds expectations
2] Add the user as a guest
As the error states, the account does not exist in the MS account directory. Office 365 apps might be using the wrong tenant details to sign in. To fix this, add the user as a guest if you have administrative privileges. Follow the steps below ;
- Go to the Azure portal and log in to the User Administrator role. You can also use an account with permission to invite guests to the directory.
- Locate and select Azure Active Directory and click Users. From the new menu, select Invite external user.
The above method allows you to add the guest to your tenant using the email address. However, if you would like to create a guest user with a domain account, go to User Administrator > Azure Active Directory > Users > Create new user. Make sure you change to Guest under the User type.
TIP: Use the email address of the guest you want to invite, select the preferred display username and you may also add a customized message to the user. If you wish, you can CC another recipient if there is a need to. Finally, click the Review + invite button and select Next: Properties. Follow the on-screen directions to add other details that you may prefer.
3] Use the right account credentials
If a user tries to sign in using a personal or a different account other than the one created by the specific administrator, they will get the AADSTS51004 error when accessing an Office 365 app. To fix this, only use the account credentials that were used to create the guest or user account. If you are not sure, consult your administrator or the person who invited you to the Active Directory.
We hope you can now access your apps successfully.
Read next: Fix 0x80041015 Microsoft Office error.
Why does it say my Microsoft account doesn’t exist?
If you get an error saying the Microsoft account does not exist, it means that you as logging in to your account using Alias. Sometimes, you might use a new account and that makes the original account an Alias. When you try to log in using the original account, Microsoft will say the account doesn’t exist.