user20262
user20262

Reputation: 25

How to get users of Business to Consumer (B2C) tenant from Microsoft Graph

We want to use Microsoft Graph for retrieving Business to Consumer (B2C) tenant users details in our code.

GET https://graph.microsoft.com/v1.0/users 

It is giving only normal tenant users.

But we want to get all users signed up using sign up and sign in flows along with their usernames.

There is no proper documentation regarding this. Can someone with domain knowledge help us how to achieve this?

If not possible, CLI/powershell also satisfies our requirements. Please help 🙏

Upvotes: 1

Views: 156

Answers (1)

jefftrotman
jefftrotman

Reputation: 1114

I believe you're running into the limitation described in the note here - https://learn.microsoft.com/en-us/azure/active-directory-b2c/microsoft-graph-operations#how-to-programmatically-manage-microsoft-graph

Delegated permissions for users signing in through user flows or custom policies cannot be used against delegated permissions for Microsoft Graph API.

Notice how you can't grant a delegated permission (for instance User.Read) to a B2C App Registration the way you can to a "normal" Azure AD App Registration. But - you can grant an application permission (like User.Read.All) to your application.

This means you'll have to submit the Graph API request using an auth token granted to your application, not to the user.

Upvotes: 2

Related Questions