Building Block for adding MS Graph Api
$ dotnet add package Enigmatry.Entry.GraphApiBuilding Block for using the Microsoft AD Graph API
You can use the AppAddGraphApi extension method on IServiceCollection to register a scoped inastance of GraphServiceClient:
public void ConfigureServices(IServiceCollection services)
{
...
services.AppAddGraphApi(_configuration);
}
Example:
"App": {
"GraphApi": {
"Enabled": true,
"TenantId": "AZURE_AD_TENANT_ID",
"ClientId": "APP_REGISTRATION_CLIENT_ID",
"ClientSecret": "APP_REGISTRATION_CLIENT_SECRET",
"PasswordPolicies": "OPTIONAL_LIST_PASSWORD_POLICIES"
},
GraphServiceClientEnabled can be used how you see fit, it is not used by the building block.PasswordPolicies can be used to supply a list of Password policies. Used by some of the GraphServiceClient extensions.The Building Block also contains a number of extension methods for GraphServiceClient: