FrodeHus.Azure.FunctionsNETWorker.Authentication 1.0.0

.NET 5.0
dotnet add package FrodeHus.Azure.FunctionsNETWorker.Authentication --version 1.0.0
NuGet\Install-Package FrodeHus.Azure.FunctionsNETWorker.Authentication -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FrodeHus.Azure.FunctionsNETWorker.Authentication" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FrodeHus.Azure.FunctionsNETWorker.Authentication --version 1.0.0
#r "nuget: FrodeHus.Azure.FunctionsNETWorker.Authentication, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FrodeHus.Azure.FunctionsNETWorker.Authentication as a Cake Addin
#addin nuget:?package=FrodeHus.Azure.FunctionsNETWorker.Authentication&version=1.0.0

// Install FrodeHus.Azure.FunctionsNETWorker.Authentication as a Cake Tool
#tool nuget:?package=FrodeHus.Azure.FunctionsNETWorker.Authentication&version=1.0.0

Sample configuration

The middleware expects Azure AD configuration in the form of:

    "AzureAd": {
        "Instance": "",
        "TenantId": "your tenant id",
        "ClientId": "your application id"
public static void Main()
            var host = new HostBuilder()
             .ConfigureAppConfiguration(c =>
                    c.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
                .ConfigureServices((b, s) =>
                .ConfigureFunctionsWorkerDefaults(app => app.UseMiddleware<AuthenticationMiddleware>())


To verify authorization, you can tag your functions with [RequireRoles("User,Admin")] and then call the extension method FunctionContext.VerifyUserRoles() like in this example:

        public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData req,
            FunctionContext executionContext)
            if (!executionContext.VerifyUserRoles())
                return req.CreateResponse(HttpStatusCode.Forbidden);

            var response = req.CreateResponse(HttpStatusCode.OK);
            return response;
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 279 3/25/2021