Entra.EventHandlers.AzureFunctions 1.6.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Entra.EventHandlers.AzureFunctions --version 1.6.3
                    
NuGet\Install-Package Entra.EventHandlers.AzureFunctions -Version 1.6.3
                    
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="Entra.EventHandlers.AzureFunctions" Version="1.6.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Entra.EventHandlers.AzureFunctions" Version="1.6.3" />
                    
Directory.Packages.props
<PackageReference Include="Entra.EventHandlers.AzureFunctions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Entra.EventHandlers.AzureFunctions --version 1.6.3
                    
#r "nuget: Entra.EventHandlers.AzureFunctions, 1.6.3"
                    
#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.
#:package Entra.EventHandlers.AzureFunctions@1.6.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Entra.EventHandlers.AzureFunctions&version=1.6.3
                    
Install as a Cake Addin
#tool nuget:?package=Entra.EventHandlers.AzureFunctions&version=1.6.3
                    
Install as a Cake Tool

Entra.EventHandlers.AzureFunctions

Azure Functions hosting adapter for Microsoft Entra External ID and Microsoft Entra Workforce authentication event handlers.

This package provides Azure Functions integration for the Entra.EventHandlers ecosystem, enabling strongly typed event handlers, dependency injection, event routing, HTTP adaptation, and centralized event orchestration.

Installation

dotnet add package Entra.EventHandlers.AzureFunctions

Features

  • Azure Functions Isolated Worker integration
  • Multi-event router function
  • Single-event function base classes
  • Automatic request deserialization
  • Automatic response serialization
  • Dynamic handler resolution
  • Centralized event orchestration
  • Structured error handling
  • Dependency injection integration
  • Fully testable architecture

Quick Start

Register Entra.EventHandlers:

builder.Services.AddEntraEventHandlers();

Create a router function:

public sealed class EntraEventRouterFunction(
    ILogger<EntraEventRouterFunction> logger,
    IHttpAdapter httpAdapter,
    IEntraEventOrchestrator orchestrator
) : EntraEventRouterFunctionBase(logger, httpAdapter, orchestrator)
{
    [Function("Router")]
    public Task<HttpResponseData> RunAsync(
        [HttpTrigger(
            AuthorizationLevel.Function,
            "post",
            Route = "router")]
        HttpRequestData req)
        => InvokeAsync(req);
}

The router function automatically:

  • Deserializes incoming event requests
  • Resolves handlers
  • Executes handlers
  • Serializes event responses
  • Maps exceptions to HTTP responses
  • Uses IHttpAdapter for HTTP request and response adaptation

The recommended approach is a single router function capable of handling multiple Microsoft Entra event types.

Benefits include:

  • Single HTTP endpoint
  • Centralized configuration
  • Minimal boilerplate
  • Automatic event dispatching
  • Consistent error handling
  • Easier maintenance

Router Function

The router function provides:

  • Automatic event deserialization
  • Event orchestration
  • Dynamic handler resolution
  • Handler invocation
  • Response serialization
  • Structured exception handling

A single Azure Function can process multiple event types through the same orchestration pipeline.


Dependency Injection

Register Entra.EventHandlers services:

builder.Services.AddEntraEventHandlers();

This automatically registers:

  • IHttpAdapter
  • Event orchestrator
  • Handler resolver
  • Event handlers discovered in the application
  • Azure Functions hosting components

Most applications do not require additional Entra.EventHandlers registrations.


Handler Discovery

Handlers are automatically discovered and resolved using the incoming event type.

Example:

public class TokenIssuanceStartHandler(
    ILogger<TokenIssuanceStartHandler> logger)
    : TokenIssuanceStartHandlerBase(logger)
{
}

No manual registration is required.

When Microsoft Entra sends a matching event, the framework automatically resolves and executes the appropriate handler.


Alternative: Single-Event Functions

The package also provides dedicated function base classes for individual event types.

Available base classes:

  • AttributeCollectionStartFunctionBase
  • AttributeCollectionSubmitFunctionBase
  • EmailOtpSendFunctionBase
  • PasswordSubmitFunctionBase
  • TokenIssuanceStartFunctionBase
  • VerifiedIdClaimValidationFunctionBase

Example:

public sealed class TokenIssuanceStartFunction(
    ILogger<TokenIssuanceStartFunction> logger,
    IHttpAdapter httpAdapter,
    ITokenIssuanceStartHandler handler
) : TokenIssuanceStartFunctionBase(
        logger,
        httpAdapter,
        handler)
{
    [Function("TokenIssuanceStart")]
    public Task<HttpResponseData> RunAsync(
        [HttpTrigger(
            AuthorizationLevel.Function,
            "post",
            Route = "tokenissuancestart")]
        HttpRequestData req)
        => InvokeAsync(req);
}

Single-event functions may be useful when:

  • Each event requires its own endpoint
  • Teams manage events independently
  • Routing is handled externally

Supported Event Types

The hosting adapter supports all event handlers implemented using the Entra.EventHandlers ecosystem.

External ID

  • AttributeCollectionStart
  • AttributeCollectionSubmit
  • EmailOtpSend
  • PasswordSubmit
  • TokenIssuanceStart

Workforce

  • VerifiedIdClaimValidation

Ecosystem Architecture

The Entra.EventHandlers ecosystem is organized into layers:

  • Entra.EventHandlers.Abstractions provides shared protocol contracts
  • Entra.EventHandlers provides External ID implementations
  • Entra.EventHandlers.Workforce provides Workforce implementations
  • Entra.EventHandlers.Security provides PasswordSubmit security integrations
  • Entra.EventHandlers.AspNetCore provides ASP.NET Core hosting integration
  • Entra.EventHandlers.AzureFunctions provides Azure Functions hosting integration

Applications typically reference one or more implementation packages together with a hosting package.


Testing

The hosting infrastructure is designed to be testable.

Because handlers remain isolated from hosting concerns, business logic can be tested without requiring Azure Functions infrastructure.

Benefits include:

  • Fast unit tests
  • Simple mocking
  • Dependency injection support
  • Clear separation of concerns

Example:

var result = await handler.HandleAsync(request);

Azure Functions classes should remain thin transport adapters while handlers contain the application behavior.


Documentation

Full documentation, event guides, hosting guides, and samples:

https://github.com/szubajak/entra-event-handlers/tree/main/docs

Azure Functions hosting guide:

https://github.com/szubajak/entra-event-handlers/blob/main/docs/hosting/azure-functions.md

AI-friendly repository metadata:

https://github.com/szubajak/entra-event-handlers/blob/main/llms.txt


Samples

Complete Azure Functions sample:

https://github.com/szubajak/entra-event-handlers/tree/main/samples/AzureFunctionsSample

Minimal Azure Functions sample:

https://github.com/szubajak/entra-event-handlers-azurefunctions

The samples demonstrate:

  • Dependency injection setup
  • Router function hosting
  • Single-event function hosting
  • Event orchestration
  • Shared handler implementations

Package Purpose
Entra.EventHandlers.Abstractions Public contracts and protocol models
Entra.EventHandlers External ID implementation layer
Entra.EventHandlers.Workforce Workforce implementation layer
Entra.EventHandlers.AspNetCore ASP.NET Core hosting adapter
Entra.EventHandlers.Security PasswordSubmit decryption and Azure Key Vault integration

License

This package is licensed under the Business Source License (BSL).

The Entra.EventHandlers.Abstractions package is licensed under the MIT License.

See the repository for licensing details and commercial licensing information.


Further Reading

Entra External ID .NET Handlers Deep Dive

https://medium.com/@jakub.szubarga/entra-external-id-dotnet-handlers-a7447dc1e437

Building CIAM-Ready Azure Functions with Entra.EventHandlers

https://medium.com/@jakub.szubarga/entra-eventhandlers-ciam-azure-functions-97c5e1940272

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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.7.0 110 11/16/2026
1.6.3 153 10/27/2026
1.6.2 126 10/26/2026
1.6.1 125 10/14/2026
1.6.0 120 10/9/2026
1.5.1 135 9/23/2026
1.5.0 131 9/14/2026
1.4.4 148 9/10/2026
1.4.3 201 7/16/2026
1.4.2 146 7/16/2026
1.4.1 189 6/29/2026
1.4.0 156 6/29/2026
1.3.5 166 6/26/2026
1.3.4 162 6/25/2026
1.3.3 160 6/25/2026
1.3.2 173 6/18/2026
1.3.1 155 6/16/2026
1.3.0 145 6/11/2026
1.2.9 151 6/8/2026
1.2.8 147 6/8/2026
Loading failed

Includes Azure Functions hosting adapter for Microsoft Entra External ID and Workforce Authentication
Event Handlers. Provides http adapter, DI integration, router function, single-event
function base classes, unified execution pipeline, and structured error handling.