Serilog.Enrichers.AzureClaims
1.1.4
dotnet add package Serilog.Enrichers.AzureClaims --version 1.1.4
NuGet\Install-Package Serilog.Enrichers.AzureClaims -Version 1.1.4
<PackageReference Include="Serilog.Enrichers.AzureClaims" Version="1.1.4" />
<PackageVersion Include="Serilog.Enrichers.AzureClaims" Version="1.1.4" />
<PackageReference Include="Serilog.Enrichers.AzureClaims" />
paket add Serilog.Enrichers.AzureClaims --version 1.1.4
#r "nuget: Serilog.Enrichers.AzureClaims, 1.1.4"
#:package Serilog.Enrichers.AzureClaims@1.1.4
#addin nuget:?package=Serilog.Enrichers.AzureClaims&version=1.1.4
#tool nuget:?package=Serilog.Enrichers.AzureClaims&version=1.1.4
Serilog.Enrichers.AzureClaims and Serilog.Enrichers.Claims
Enriches Serilog events with information from the ClaimsPrincipal.
Install the Serilog.Enrichers.AzureClaims NuGet package
Install the Serilog.Enrichers.Claims NuGet package
Install-Package Serilog.Enrichers.AzureClaims
Install-Package Serilog.Enrichers.Claims
Then, apply the enricher to your LoggerConfiguration:
Log.Logger = new LoggerConfiguration()
.Enrich.WithUpn()
.Enrich.WithDisplayName()
.Enrich.WithTenantId()
.Enrich.WithObjectId()
.Enrich.WithAppId()
.Enrich.WithCustomClaim("AnyExistingClaim") // Available from Serilog.Enrichers.Claims
// ...other configuration...
.CreateLogger();
Included enrichers
Available from Serilog.Enrichers.AzureClaims
WithUpn()- addsUserPrincipalNamebased on the ClaimTypehttp://schemas.xmlsoap.org/ws/2005/05/identity/claims/upnWithDisplayName()- addsDisplayNamebased on the ClaimTypehttp://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameornameorpreferred_usernameWithTenantId()- addsTenantIdbased on the ClaimTypehttp://schemas.microsoft.com/identity/claims/tenantidortidWithObjectId()- addsObjectIdbased on the ClaimTypehttp://schemas.microsoft.com/identity/claims/objectidentifieroroidWithAppId()- addsAppIdbased on the CLaimTypeappidorazp
Available from Serilog.Enrichers.Claims
WithCustomClaim("AnyExistingClaim")based on the claim you want to extract from the ClaimsPrincipal
Installing into an ASP.NET Core Web Application
The IHttpContextAccessor singleton should be registered, but is not required for these nugets to run. The enrichers have access to the requests HttpContext to extract the data.
This is what your Program class should contain in order for this enricher to work as expected:
// ...
using Serilog;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.AddSerilog(new LoggerConfiguration()
.Enrich.WithUpn()
.Enrich.WithDisplayName()
.Enrich.WithTenantId()
.Enrich.WithObjectId()
.Enrich.WithAppId()
.Enrich.WithCustomClaim("AnyExistingClaim")
.CreateLogger());
var app = builder.Build();
app.UseSerilogRequestLogging();
// ...
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- Microsoft.Identity.Web (>= 3.9.4)
- Serilog (>= 4.3.0)
-
net9.0
- Microsoft.Identity.Web (>= 3.9.4)
- Serilog (>= 4.3.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Serilog.Enrichers.AzureClaims:
| Package | Downloads |
|---|---|
|
Intility.Logging.AspNetCore
This package enables common logging infrastructure to any aspnet or dotnet project using generic host mechanism. Additional logging capabilities are available through the extension packages Intility.Extensions.Logging.* |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.4 | 14,268 | 7/2/2025 |
| 1.1.3 | 5,004 | 3/3/2025 |
| 1.1.2 | 22,921 | 1/10/2025 |
| 1.1.1 | 11,892 | 11/22/2024 |
| 1.1.1-rc.2 | 109 | 11/22/2024 |
| 1.1.1-rc.1 | 100 | 11/22/2024 |
| 1.1.1-rc.0 | 125 | 11/22/2024 |
| 1.1.0 | 185 | 11/21/2024 |
| 1.0.3 | 15,167 | 1/10/2024 |
| 1.0.2 | 48,524 | 11/16/2023 |
| 1.0.1 | 7,736 | 7/11/2023 |
| 1.0.1-tags-v1-0-1-rc--0001 | 246 | 7/11/2023 |
| 1.0.0 | 284 | 7/11/2023 |
| 0.1.2 | 407 | 6/28/2023 |
| 0.1.1 | 739 | 6/27/2023 |
| 0.1.0 | 266 | 6/27/2023 |