0
votes

Can anyone confirm / deny this statement?

GraphServiceClient.Invitations() does not support inviting B2C Consumer users

I'm looking for a simpler way to invite Consumer users to my Azure B2C tenant. To be clear, these are application users and not folks I want to have access to my B2C tenant.

There are quite a few new-to-me MS documentation bits floating around for B2C and MS Graph. Digging through these new docs, I got the impression I could use MS Graph to generate an invitation to my B2C tenant.

An invitation gets created, huzzah, but I get punched in the face with an AD related error:

AADB2B_0001 : We cannot create a self-service Azure AD account for you because the directory is federated. Tenant's admin must create an account for you.

For reference:

The Microsoft Graph documentation path I followed:

https://docs.microsoft.com/en-us/azure/active-directory-b2c/user-overview

https://docs.microsoft.com/en-us/azure/active-directory-b2c/microsoft-graph-operations

https://docs.microsoft.com/en-us/graph/api/user-post-users?view=graph-rest-1.0&tabs=http

https://docs.microsoft.com/en-us/graph/api/invitation-post?view=graph-rest-1.0&tabs=http

Code Example:

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var invitation = new Invitation
{
    InvitedUserEmailAddress = "[email protected]",
    InviteRedirectUrl = "https://myapp.contoso.com"
};

await graphClient.Invitations
    .Request()
    .AddAsync(invitation);

Thank you.

1

1 Answers

1
votes

I hit this wall early on myself and have come to the same conclusion.

Inviting Users from the Graph or the B2C Blade in the Azure Portal results in inviting what I would describe as an Administrator User to assist in the management of B2C, not authenticate to my Relying Parties.

Here's some reference on the subject that sent me down that path:

https://docs.microsoft.com/en-us/answers/questions/66524/invitation-sent-and-user-can39t-sign-in-b2c.html