Configuring Microsoft Graph bindings for Azure Functions with B2C

Create an App Registration with proper user

App Registration Relationship

Create a new B2C user

Create a new user with admin

Creating App Registration by the B2C user

Create an App Registration by the B2C user
Create a new app registrations
Select “Windows Azure Active Directory” permission
Grant permissions to the App Registration

Get the Application ID and Password

ApplicationID and Key

Configure Function App

Authentication / Authorization settings
Azure Active Directory
Active Directory Authentication (Advanced)

Writing an Azure Functions using Graph Bindings

public static async Task<IActionResult> RunAsync([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequest req,            
[Token(Identity = TokenIdentityMode.ClientCredentials, Resource = "https://graph.windows.net")]string token,
TraceWriter log)
request.RequestUri = new System.Uri("https://graph.windows.net/someorganication.onmicrosoft.com/users?api-version=1.6");            request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);            var client = await httpClient.SendAsync(request);

Resource

Special Thanks

The hackfest team

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store