Searching for Identities in Azure AD B2C using the Graph API


I discussed Identities here.

You may find that you get an error when you try and add an identity. Maybe it’s a duplicate? The question is how to find the duplicate identity in B2C?

You can find the search query parameters here.

I’ve used the B2C user utility.

The search queries would be the same if you used e.g. GraphExplorer.

Using the utility, let’s create some identities:

"accountEnabled": true,
"displayName": "Adele Vance",
"mailNickname": "AdeleV",
"userPrincipalName": "",
"passwordProfile": {
"forceChangePasswordNextSignIn": true,
"password": "xWwvJ]6NMw+bWH-d"
"identities": [
"signInType": "userName",
"issuer": "",
"issuerAssignedId": "johnsmith"
"signInType": "emailAddress",
"issuer": "",
"issuerAssignedId": ""
"signInType": "federated",
"issuer": "",
"issuerAssignedId": "5eecb0cdgf"

Place this in a file called “create-user.json”.


b2c create-user create-user.json

Now if you look at the user in B2C:

Image showing user identity with Issuer, Sign-in type and Issuer Assigned ID

Now I can search e.g.

B2C Get-User $filter=(“identities/any(i:i/issuer eq ‘’ and i/issuerAssignedId eq ‘johnsmith’)”)

This shows:

Using tenant tenant.onmicrosoft.comGET$filter=(identities/any(i:i/issuer eq '' and i/issuerAssignedId eq 'johnsmith'))
Authorization: Bearer eyJ0eX...ZUc4UE5qZ1ZmQ1hWSXp2MWZWQVVKVi13...
200: OKUser details ...

Notice that you use the “beta” endpoint.


B2C Get-User $filter=(“identities/any(i:i/issuer eq ‘’ and i/issuerAssignedId eq ‘5eecb0cdgf’)”)


B2C Get-User $filter=(“identities/any(i:i/issuer eq ‘’)”)

It doesn’t look like “signInNames” or “signInType” are supported search types.

"message": "Property 'signInType' does not exist as a declared property or extension property."

Just FYI: if you want to search on an attribute:

B2C Get-User $filter=startswith(userPrincipalName,’’)


B2C Get-User $filter=startswith(“mailNickname”,’AdeleV’)

All good!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rory Braybrook

Rory Braybrook


NZ Microsoft Identity dude and MVP. Azure AD/B2C/ADFS/Auth0/identityserver. StackOverflow: Presentations: