Login Power Pages Failed with error “Multiple entities are present”
Recently, we encountered an issue that some portal user failed to login Power Pages site when signing in via Azure AD B2C. If the site is not enabled custom error, or it is configured diagnostics logging, we can see the error message from server side is “Multiple entities are present”.
Reason
With some investigations, we found the issue was due to duplicate external identities.
As we know, when first time signing in Power Pages site via an external identity provider, like Azure AD, Azure AD B2C, Google, etc, it will generate an External Identity record and associated with the contact record. The External Identity record contains Username, Identity Provider and the contact which associated with. The Username is the object id in the external identity provider, the Identity Provider is the issuer’s URL.
So, when signing in Power Pages via an external identity provider, once the sign in process is completed in external identity provider side, it will redirect to Power Pages to find out which contact (Portal user) is mapping to the user from the external identity, then signing in the site with the contact.
Get City South’s stories in your inbox
Join Medium for free to get updates from this writer.
However, if there are multiple external identity record with same values in Username and Identity Provider fields, then it will cause “Multiple entities are present” error, because Power Pages doesn’t know which external identity record is the correct one and which associated contact is the correct portal user.
Find duplicate external identities
To find out duplicate external identities, you need to know the Username (Object Id) first. You can either find it from external identity provider system or find the contact record from Dataverse first, then switch to “Web Authentication” tab to get Username from “External Identities” subgrid.
With the value of Username, you can find the duplicate external identities via Advanced Find or WebApi. Once the duplicate identities are found, you need to delete the one or delete the associated contact record, the duplicate identities will be deleted as well, then try to sign in the site again.
https://xxx.crm.dynamics.com/api/data/v9.2/adx_externalidentities?$select=adx_username,adx_identityprovidername,_adx_contactid_value&$filter=adx_username eq 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'Thanks!





