How to Implement Microsoft.Identity.Web in Azure Functions V4 and .NET 6 | by Tobias Streng | Feb, 2022

Having trouble getting Microsoft.Identity.Web working on the latest Azure Functions V4? This guide is for you!

Tobias Streng
Photo by Brett Jordan on Unsplash
System.Private.CoreLib: Exception while executing function: SampleFunc. Microsoft.Identity.Web: Could not load file or assembly 'Microsoft.IdentityModel.Tokens, Version=
Successfully execute authentication function locally.
Unable to fetch the host status of your function app. To use log streaming, please make sure your function host is running.
Azure Functions runtime is unreachable

Prepare your Project

dotnet new func2 --auth SingleOrg

Add the required Dependencies

See the Results

Successfull Authentication
2022-02-21T14:18:44.706 [Information] Executing 'SampleFunc' (Reason='This function was programmatically called via the host APIs.'2022-02-21T14:18:44.707 [Information] Executing Authentication Request...2022-02-21T14:18:44.707 [Information] Authentication Success: True.2022-02-21T14:18:44.707 [Information] Executed 'SampleFunc' (Succeeded, Duration=1ms)

Leave a Comment