B2C tenant throws DirectoryUniquenessException when adding a user with unique email.

Gola, Mariusz 45 Reputation points
2025-02-14T19:52:03.39+00:00

Hi and thank you in advance.

Trying to create a user in a B2C tenant throws a Microsoft.Online.DirectoryServices.DirectoryUniquenessException, I have verified that the email is not part of the directory. What else can I do or how do I find the conflicting user?

thank you

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

1 answer

Sort by: Most helpful
  1. Sanoop M 4,310 Reputation points Moderator
    2025-02-14T22:55:18.9833333+00:00

    Hello @Gola, Mariusz,

    Thank you for posting your query on Microsoft Q&A.

    I understand that when you are trying to create a new user in a Azure AD B2C tenant, it is throwing this error Microsoft.Online.DirectoryServices.DirectoryUniquenessException.

    Please note that this issue is related to the uniqueness of the user's identity in Microsoft Entra ID(Azure AD). Even though you have verified that you do not have a user account with the same email address or UPN(User Principal Name) that was about to be created, but it is possible that there is a conflict with an existing user's immutable ID.

    The immutable ID is a unique identifier for each user in Azure AD B2C tenant that is used to map the user between Azure AD B2C and the application. It is possible that the user's immutable ID is still associated with their old account in your Azure AD B2C tenant, even though the user account has been deleted or deactivated. This can happen if the user's old account was not properly removed from your Azure AD B2C tenant.

    To resolve this issue, you can try the following steps:

    1. Check if the user's old account is still present in your Azure AD B2C tenant. If it is present, delete or deactivate that account.
    2. Check if the user's immutable ID is still associated with their old account. If it is still associated, please remove the immutable ID from the old account.
    3. Please try registering again with the user's new email address and check the behavior.

    I hope this above information provided is helpful. Please feel free to reach out if you have any further questions.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.