SignInNames available in Microsoft Graph
- SignInNames available in the new Microsoft Graph API
- Going further with Microsoft Graph by using SDK and MSAL.NET: CRUD operations on user Entity
If you were using https://graph.microsoft.com/ you have probably noticed that it was not possible to create a User in Azure AD B2C with a custom signInName unlike the older Graph API (https://graph.windows.net/).
That feature is available in the new beta release ! (https://graph.microsoft.com/beta/)
Let’s see how we can migrate to the new beta release!
I wanted (and I still want to) to log in in Azure B2C with my personal Gmail address, the payload was looking like this:
Data model returned from Graph API looks like this (I built my own model instead of using any SDK):
Now let’s see what the new Microsoft Graph user payload looks like:
Models, especially “signInNames” are now named “identities” and “creationType” property has disappeared.
A new property has been added: “issuerAssignedId” (has implicitly made “creationType” property obsolete) and this is the value of your custom signInName. You have to set your “issuer” property even if you are using a custom email address like Gmail.
CRUD operation with ADAL.NET
Here is a service that contains a bunch of services to manipulate User entity with Microsoft Graph (beta):
I wrote a custom client to manage operations like create, get user by userId, get user by SignInName, update user (update SignInName) and delete a user (disable). That client utilizes ADAL.NET and it works pretty well with Microsoft Graph as well as Graph API.
In the next article I will show you how to rewrite to client with MSAL.NET and the SDK.