![]() |
VOOZH | about |
dotnet add package Serilog.Enrichers.AzureClaims --version 1.2.7
NuGet\Install-Package Serilog.Enrichers.AzureClaims -Version 1.2.7
<PackageReference Include="Serilog.Enrichers.AzureClaims" Version="1.2.7" />
<PackageVersion Include="Serilog.Enrichers.AzureClaims" Version="1.2.7" />Directory.Packages.props
<PackageReference Include="Serilog.Enrichers.AzureClaims" />Project file
paket add Serilog.Enrichers.AzureClaims --version 1.2.7
#r "nuget: Serilog.Enrichers.AzureClaims, 1.2.7"
#:package Serilog.Enrichers.AzureClaims@1.2.7
#addin nuget:?package=Serilog.Enrichers.AzureClaims&version=1.2.7Install as a Cake Addin
#tool nuget:?package=Serilog.Enrichers.AzureClaims&version=1.2.7Install as a Cake Tool
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();
WithUpn() - adds UserPrincipalName based on the ClaimType http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upnWithDisplayName() - adds DisplayName based on the ClaimType http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name or name or preferred_usernameWithTenantId() - adds TenantId based on the ClaimType http://schemas.microsoft.com/identity/claims/tenantid or tidWithObjectId() - adds ObjectId based on the ClaimType http://schemas.microsoft.com/identity/claims/objectidentifier or oidWithAppId() - adds AppId based on the CLaimType appid or azpWithCustomClaim("AnyExistingClaim") based on the claim you want to extract from the ClaimsPrincipalThe 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 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
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.* |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.7 | 1,052 | 5/27/2026 |
| 1.2.6 | 148 | 4/28/2026 |
| 1.2.5 | 1,227 | 4/13/2026 |
| 1.2.4 | 618 | 3/2/2026 |
| 1.2.3 | 17,423 | 2/20/2026 |
| 1.2.2 | 26,748 | 1/2/2026 |
| 1.2.1 | 17,301 | 11/19/2025 |
| 1.1.4 | 37,610 | 7/2/2025 |
| 1.1.3 | 5,704 | 3/3/2025 |
| 1.1.2 | 31,587 | 1/10/2025 |
| 1.1.1 | 14,181 | 11/22/2024 |
| 1.1.1-rc.2 | 172 | 11/22/2024 |
| 1.1.1-rc.1 | 156 | 11/22/2024 |
| 1.1.1-rc.0 | 181 | 11/22/2024 |
| 1.1.0 | 740 | 11/21/2024 |
| 1.0.3 | 16,465 | 1/10/2024 |
| 1.0.2 | 50,782 | 11/16/2023 |
| 1.0.1 | 8,277 | 7/11/2023 |
| 1.0.1-tags-v1-0-1-rc--0001 | 308 | 7/11/2023 |
| 1.0.0 | 837 | 7/11/2023 |