I need to call the Microsoft Graph API to create a user in Azure AD.
First I need to test the console application and then run it in Azure.
https://developer.microsoft.com/en-us/graph/graph-explorer
I am new to the Microsoft Graph API how to connect and execute the API from a C # console application.
I have already registered the application in AAD.
I am trying to get a token like:
string resourceId = "https://graph.microsoft.com";
string tenantId = "<tenantID>";
string authString = "https://login.microsoftonline.com/" + tenantId;
string upn = String.Empty;
string clientId = "<ClientID>";
string clientSecret = "<clientSecret>";
log.Verbose("ClientSecret=" + clientSecret);
log.Verbose("authString=" + authString);
var authenticationContext = new AuthenticationContext(authString, false);
ClientCredential clientCred = new ClientCredential(clientId, clientSecret);
AuthenticationResult authenticationResult = await authenticationContext.AcquireTokenAsync(resourceId,clientCred);
string token = authenticationResult.AccessToken;
log.Verbose("token=" + token);
I am trying to use an existing AADB2C. B2C-extension-applications. Do not change. Used by AADB2C to store user data.
I have allowed permission:

I do not receive an exception and do not receive an access token, and the program silently exits
Also:
A new library has appeared
<package id="Microsoft.Identity.Client" version="1.1.0-preview" targetFramework="net46" />
How can I direct login without logging in with the following and get a token? PublicClientApplication