Use Microsoft Graph to Invite Consumer Users to B2C Tenant

Viewed 1223

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 = "yyy@test.com",
    InviteRedirectUrl = "https://myapp.contoso.com"
};

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

Thank you.

1 Answers
Related