Creating user in ADB2C failed through Graph API

Sankalp Abhale 0 Reputation points
2023-03-07T10:35:36.18+00:00

Hello,

I am integrating my current application with azure ADB2c.

As a part of it, I am trying to create user in AZURE ADB2C using Graph API. But I am getting error as Object reference not set to an instance of an object.

As a part of permission I have permission :

Application Permission : User.ReadWrite.ALL

I read that same permissions should be given in Delegated permissions as well.

Just wanted to know if those are required. Attaching current permissions here.Test1

Note : I was trying to add User.ReadWrite.ALL in delegated permissions, but I don't see those in the list. If you can also help me on that, it would be grateful!
Test2

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,521 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,389 questions
{count} votes

2 answers

Sort by: Most helpful
  1. James Hamil 21,466 Reputation points Microsoft Employee
    2023-03-07T22:10:03.0166667+00:00

    Hi @Sankalp Abhale , yes you do need User.ReadWrite in your Delegated permissions. This might not be appearing because it required admin consent. Follow this guide to understand admin consent and let me know if it helps you. If not please let me know and I can help you further.

    If this answer helped you please mark it as "Verified" so other users can reference it.

    Thank you,

    James

    0 comments No comments

  2. CarlZhao-MSFT 36,736 Reputation points
    2023-03-08T02:29:55.4766667+00:00

    Hi @Sankalp Abhale

    This is because your app is registered as: "for authenticating users with user flows". This will prevent your app from being granted graph API delegated permissions.

    You should register app as:

    27

    Or keep the current app, then go to the manifest of the current app, and change the value of signInAudience to: AzureADMyOrg.

    26

    After that, you'll be able to grant graph API delegated permissions to your app:

    User's image

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.