Our Blazor web app allows people to register as Turtles, meaning they will help others in need. In the field, Turtles use the official Dynamics mobile app. To use the official app, users need an Azure AD user with a Dynamics license and a security role in Dynamics.
Instead of having to manually create users in Azure AD and assign licenses and Dynamics security roles, this infrastructure is programmatically set up.
The backend of the Blazor web app uses a custom Azure API client which programmatically sets up the infrastructure: creation of Azure AD users and assigning of Dynamics licenses.
Because of our Infrastructure as Code, users are able to use the official Dynamics mobile app automatically after registering – no manual steps required!
The following image shows the method that creates an Azure AD user and assigns the Dynamics license.
Interaction with Azure AD is done using GraphServiceClient from the Microsoft.Graph NuGet package. Authentication is done using an Access Token retrieved using functionality from the Microsoft.Identity NuGet package.