Leonardo
Leonardo

Reputation: 11381

Azure AD B2C - How to create a consumer user programatically?

Which API should I call on Azure B2C to create a CONSUMER user? Apparently this one is going away...

Upvotes: 0

Views: 1192

Answers (2)

Jas Suri - MSFT
Jas Suri - MSFT

Reputation: 11315

Here is the correct example and doc.

https://learn.microsoft.com/en-us/azure/active-directory-b2c/manage-user-accounts-graph-api

https://learn.microsoft.com/en-us/graph/api/user-post-users?view=graph-rest-1.0&tabs=http#example-2-create-a-user-with-social-and-local-account-identities

Do not use forceChangePassword=true unless using User Flows V1 (deprecated). You must always set password expiry policy to never.

Upvotes: 1

Leonardo
Leonardo

Reputation: 11381

Use this Microsoft Graph Api.

here is a sample request

POST https://graph.microsoft.com/v1.0/users
Content-type: application/json

{
  "accountEnabled": true,
  "displayName": "displayName-value",
  "mailNickname": "mailNickname-value",
  "userPrincipalName": "[email protected]",
  "passwordProfile" : {
    "forceChangePasswordNextSignIn": true,
    "password": "password-value"
  }
}

Upvotes: 0

Related Questions