From 6d90cbe42de59f228cf03b2c73ea67bd06f1415a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 10 Nov 2025 23:46:11 +0000 Subject: [PATCH 1/7] Initial plan From 6ce720a28ff205ba20c006f79e69b3a141da51b7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 10 Nov 2025 23:52:25 +0000 Subject: [PATCH 2/7] Add Identity metrics documentation for .NET 10 Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com> --- aspnetcore/log-mon/metrics/metrics.md | 48 +++++++++++++++++-- .../security/authentication/identity.md | 13 ++++- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/aspnetcore/log-mon/metrics/metrics.md b/aspnetcore/log-mon/metrics/metrics.md index 06d2f08ffc11..7758c160bf28 100644 --- a/aspnetcore/log-mon/metrics/metrics.md +++ b/aspnetcore/log-mon/metrics/metrics.md @@ -1,10 +1,11 @@ --- title: ASP.NET Core metrics -description: Metrics for ASP.NET Core apps +ai-usage: ai-assisted author: tdykstra -ms.author: tdykstra +description: Metrics for ASP.NET Core apps monikerRange: '>= aspnetcore-8.0' -ms.date: 10/18/2023 +ms.author: tdykstra +ms.date: 11/10/2025 ms.topic: article uid: log-mon/metrics/metrics --- @@ -262,6 +263,47 @@ The proceeding test: * Makes an HTTP request to the web app. * Asserts the test using results from the metrics collector. +:::moniker range=">= aspnetcore-10.0" + +## ASP.NET Core Identity metrics + +ASP.NET Core Identity observability has been improved in .NET 10 with metrics. These metrics help you monitor user management activities and authentication processes. + +The metrics are in the `Microsoft.AspNetCore.Identity` meter and include: + +### User management metrics + +* `aspnetcore.identity.user.create.duration` - Measures the duration of user creation operations +* `aspnetcore.identity.user.update.duration` - Measures the duration of user update operations +* `aspnetcore.identity.user.delete.duration` - Measures the duration of user deletion operations +* `aspnetcore.identity.user.check_password_attempts` - Counts password verification attempts +* `aspnetcore.identity.user.generated_tokens` - Counts tokens generated for users (like password reset tokens) +* `aspnetcore.identity.user.verify_token_attempts` - Counts token verification attempts + +### Authentication metrics + +* `aspnetcore.identity.sign_in.authenticate.duration` - Measures the duration of authentication operations +* `aspnetcore.identity.sign_in.check_password_attempts` - Counts password check attempts during sign-in +* `aspnetcore.identity.sign_in.sign_ins` - Counts successful sign-ins +* `aspnetcore.identity.sign_in.sign_outs` - Counts sign-outs +* `aspnetcore.identity.sign_in.two_factor_clients_remembered` - Counts remembered two-factor clients +* `aspnetcore.identity.sign_in.two_factor_clients_forgotten` - Counts forgotten two-factor clients + +These metrics can be used to: + +* Monitor user registration and management +* Track authentication patterns and potential security issues +* Measure performance of Identity operations +* Observe two-factor authentication usage + +You can view these metrics using the techniques described earlier in this article, such as `dotnet-counters` or Prometheus with Grafana. + +```dotnetcli +dotnet-counters monitor -n YourAppName --counters Microsoft.AspNetCore.Identity +``` + +:::moniker-end + ## ASP.NET Core meters and counters See [ASP.NET Core metrics](/dotnet/core/diagnostics/built-in-metrics-aspnetcore) for a list of ASP.NET Core meters and counters. diff --git a/aspnetcore/security/authentication/identity.md b/aspnetcore/security/authentication/identity.md index ecdac609a742..859d76459040 100644 --- a/aspnetcore/security/authentication/identity.md +++ b/aspnetcore/security/authentication/identity.md @@ -1,10 +1,11 @@ --- title: Introduction to Identity on ASP.NET Core +ai-usage: ai-assisted author: wadepickett description: Use Identity with an ASP.NET Core app. Learn how to set password requirements (RequireDigit, RequiredLength, RequiredUniqueChars, and more). monikerRange: '>= aspnetcore-3.0' ms.author: wpickett -ms.date: 10/30/2025 +ms.date: 11/10/2025 uid: security/authentication/identity --- # Introduction to Identity on ASP.NET Core @@ -202,6 +203,16 @@ The template-generated app doesn't use [authorization](xref:security/authorizati For more information on `IdentityOptions`, see and [Application Startup](xref:fundamentals/startup). +:::moniker range=">= aspnetcore-10.0" + +## ASP.NET Core Identity metrics + +ASP.NET Core Identity metrics provide monitoring capabilities for user management and authentication processes. These metrics help you detect unusual sign-in patterns that might indicate security threats, track the performance of identity operations, and understand how users interact with authentication features such as two-factor authentication. This observability is particularly valuable for applications with strict security requirements or those experiencing high authentication traffic. The ASP.NET Core Identity metrics were introduced in .NET 10. + +For complete details on available metrics and how to use them, see . + +:::moniker-end + ## Scaffold Register, Login, LogOut, and RegisterConfirmation From a6b15a82df93ab05f34386a9478cbd51e57c1bd7 Mon Sep 17 00:00:00 2001 From: Wade Pickett Date: Mon, 10 Nov 2025 23:10:11 -0800 Subject: [PATCH 3/7] Update ASP.NET Core Identity documentation Fixed for moniker range. --- aspnetcore/security/authentication/identity.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aspnetcore/security/authentication/identity.md b/aspnetcore/security/authentication/identity.md index 859d76459040..50544ef0c3f5 100644 --- a/aspnetcore/security/authentication/identity.md +++ b/aspnetcore/security/authentication/identity.md @@ -203,6 +203,7 @@ The template-generated app doesn't use [authorization](xref:security/authorizati For more information on `IdentityOptions`, see and [Application Startup](xref:fundamentals/startup). +:::moniker-end :::moniker range=">= aspnetcore-10.0" ## ASP.NET Core Identity metrics @@ -212,6 +213,7 @@ ASP.NET Core Identity metrics provide monitoring capabilities for user managemen For complete details on available metrics and how to use them, see . :::moniker-end +:::moniker range=">= aspnetcore-8.0" From 1abecf1176ee142675cc56fd28a8370d0ec59788 Mon Sep 17 00:00:00 2001 From: Wade Pickett Date: Mon, 10 Nov 2025 23:26:42 -0800 Subject: [PATCH 4/7] Apply suggestion from @wadepickett Added to View Identity metric section --- aspnetcore/log-mon/metrics/metrics.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aspnetcore/log-mon/metrics/metrics.md b/aspnetcore/log-mon/metrics/metrics.md index 7758c160bf28..0a30924ff1cd 100644 --- a/aspnetcore/log-mon/metrics/metrics.md +++ b/aspnetcore/log-mon/metrics/metrics.md @@ -296,7 +296,11 @@ These metrics can be used to: * Measure performance of Identity operations * Observe two-factor authentication usage -You can view these metrics using the techniques described earlier in this article, such as `dotnet-counters` or Prometheus with Grafana. +### Viewing Identity metrics + +You can view these metrics using `dotnet-counters` to monitor them in real-time, or export them to Prometheus and visualize them in Grafana using the techniques described earlier in this article. + +For example, to monitor all Identity metrics with `dotnet-counters`: ```dotnetcli dotnet-counters monitor -n YourAppName --counters Microsoft.AspNetCore.Identity From 762fb1ea1364fcc0e2776348ce95a77bcd3054b1 Mon Sep 17 00:00:00 2001 From: Wade Pickett Date: Tue, 11 Nov 2025 09:46:06 -0800 Subject: [PATCH 5/7] Apply suggestions from code review Suggested udpated from guardrex Co-authored-by: Luke Latham <1622880+guardrex@users.noreply.github.com> --- aspnetcore/log-mon/metrics/metrics.md | 18 +++++++++--------- aspnetcore/security/authentication/identity.md | 4 +++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/aspnetcore/log-mon/metrics/metrics.md b/aspnetcore/log-mon/metrics/metrics.md index 0a30924ff1cd..1990f75bf45a 100644 --- a/aspnetcore/log-mon/metrics/metrics.md +++ b/aspnetcore/log-mon/metrics/metrics.md @@ -267,17 +267,17 @@ The proceeding test: ## ASP.NET Core Identity metrics -ASP.NET Core Identity observability has been improved in .NET 10 with metrics. These metrics help you monitor user management activities and authentication processes. +ASP.NET Core Identity observability help you monitor user management activities and authentication processes. -The metrics are in the `Microsoft.AspNetCore.Identity` meter and include: +The metrics are in the `Microsoft.AspNetCore.Identity` meter and are described in the following sections. ### User management metrics -* `aspnetcore.identity.user.create.duration` - Measures the duration of user creation operations +* `aspnetcore.identity.user.create.duration` measures the duration of user creation operations. * `aspnetcore.identity.user.update.duration` - Measures the duration of user update operations * `aspnetcore.identity.user.delete.duration` - Measures the duration of user deletion operations * `aspnetcore.identity.user.check_password_attempts` - Counts password verification attempts -* `aspnetcore.identity.user.generated_tokens` - Counts tokens generated for users (like password reset tokens) +* `aspnetcore.identity.user.generated_tokens` counts tokens generated for users , such as password reset tokens. * `aspnetcore.identity.user.verify_token_attempts` - Counts token verification attempts ### Authentication metrics @@ -291,14 +291,14 @@ The metrics are in the `Microsoft.AspNetCore.Identity` meter and include: These metrics can be used to: -* Monitor user registration and management -* Track authentication patterns and potential security issues -* Measure performance of Identity operations -* Observe two-factor authentication usage +* Monitor user registration and management. +* Track authentication patterns and potential security issues. +* Measure performance of Identity operations. +* Observe two-factor authentication usage. ### Viewing Identity metrics -You can view these metrics using `dotnet-counters` to monitor them in real-time, or export them to Prometheus and visualize them in Grafana using the techniques described earlier in this article. +You can view these metrics using `dotnet-counters` to monitor them in real-time or export them to Prometheus and visualize them in Grafana using the techniques described earlier in this article. For example, to monitor all Identity metrics with `dotnet-counters`: diff --git a/aspnetcore/security/authentication/identity.md b/aspnetcore/security/authentication/identity.md index 50544ef0c3f5..9e48a660beb1 100644 --- a/aspnetcore/security/authentication/identity.md +++ b/aspnetcore/security/authentication/identity.md @@ -204,15 +204,17 @@ The template-generated app doesn't use [authorization](xref:security/authorizati For more information on `IdentityOptions`, see and [Application Startup](xref:fundamentals/startup). :::moniker-end + :::moniker range=">= aspnetcore-10.0" ## ASP.NET Core Identity metrics -ASP.NET Core Identity metrics provide monitoring capabilities for user management and authentication processes. These metrics help you detect unusual sign-in patterns that might indicate security threats, track the performance of identity operations, and understand how users interact with authentication features such as two-factor authentication. This observability is particularly valuable for applications with strict security requirements or those experiencing high authentication traffic. The ASP.NET Core Identity metrics were introduced in .NET 10. +ASP.NET Core Identity metrics provide monitoring capabilities for user management and authentication processes. These metrics help you detect unusual sign-in patterns that might indicate security threats, track the performance of identity operations, and understand how users interact with authentication features, such as two-factor authentication. This observability is particularly valuable for apps with strict security requirements or those experiencing high authentication traffic. For complete details on available metrics and how to use them, see . :::moniker-end + :::moniker range=">= aspnetcore-8.0" From 82d54e22626bad22719429bade5d6e4e441497a9 Mon Sep 17 00:00:00 2001 From: Wade Pickett Date: Tue, 11 Nov 2025 09:46:55 -0800 Subject: [PATCH 6/7] Apply suggestion from @wadepickett Fixed comma --- aspnetcore/log-mon/metrics/metrics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/log-mon/metrics/metrics.md b/aspnetcore/log-mon/metrics/metrics.md index 1990f75bf45a..cde3ab696e97 100644 --- a/aspnetcore/log-mon/metrics/metrics.md +++ b/aspnetcore/log-mon/metrics/metrics.md @@ -277,7 +277,7 @@ The metrics are in the `Microsoft.AspNetCore.Identity` meter and are described i * `aspnetcore.identity.user.update.duration` - Measures the duration of user update operations * `aspnetcore.identity.user.delete.duration` - Measures the duration of user deletion operations * `aspnetcore.identity.user.check_password_attempts` - Counts password verification attempts -* `aspnetcore.identity.user.generated_tokens` counts tokens generated for users , such as password reset tokens. +* `aspnetcore.identity.user.generated_tokens` counts tokens generated for users, such as password reset tokens. * `aspnetcore.identity.user.verify_token_attempts` - Counts token verification attempts ### Authentication metrics From fba42c08320d54fc71d7e1ac0d82a84ad46ea9f7 Mon Sep 17 00:00:00 2001 From: Wade Pickett Date: Tue, 11 Nov 2025 10:01:13 -0800 Subject: [PATCH 7/7] Fix punctuation and formatting in metrics.md Corrected punctuation and formatting for consistency in metrics documentation. --- aspnetcore/log-mon/metrics/metrics.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/aspnetcore/log-mon/metrics/metrics.md b/aspnetcore/log-mon/metrics/metrics.md index cde3ab696e97..126d085bbe65 100644 --- a/aspnetcore/log-mon/metrics/metrics.md +++ b/aspnetcore/log-mon/metrics/metrics.md @@ -257,7 +257,7 @@ The proceeding test: * Bootstraps a web app in memory with . `Program` in the factory's generic argument specifies the web app. * Collects metrics values with - * Requires a package reference to `Microsoft.Extensions.Diagnostics.Testing` + * Requires a package reference to `Microsoft.Extensions.Diagnostics.Testing`. * The `MetricCollector` is created using the web app's . This allows the collector to only report metrics values recorded by test. * Includes the meter name, `Microsoft.AspNetCore.Hosting`, and counter name, `http.server.request.duration` to collect. * Makes an HTTP request to the web app. @@ -274,20 +274,20 @@ The metrics are in the `Microsoft.AspNetCore.Identity` meter and are described i ### User management metrics * `aspnetcore.identity.user.create.duration` measures the duration of user creation operations. -* `aspnetcore.identity.user.update.duration` - Measures the duration of user update operations -* `aspnetcore.identity.user.delete.duration` - Measures the duration of user deletion operations -* `aspnetcore.identity.user.check_password_attempts` - Counts password verification attempts +* `aspnetcore.identity.user.update.duration` measures the duration of user update operations. +* `aspnetcore.identity.user.delete.duration` measures the duration of user deletion operations +* `aspnetcore.identity.user.check_password_attempts` counts password verification attempts. * `aspnetcore.identity.user.generated_tokens` counts tokens generated for users, such as password reset tokens. -* `aspnetcore.identity.user.verify_token_attempts` - Counts token verification attempts +* `aspnetcore.identity.user.verify_token_attempts` counts token verification attempts. ### Authentication metrics -* `aspnetcore.identity.sign_in.authenticate.duration` - Measures the duration of authentication operations -* `aspnetcore.identity.sign_in.check_password_attempts` - Counts password check attempts during sign-in -* `aspnetcore.identity.sign_in.sign_ins` - Counts successful sign-ins -* `aspnetcore.identity.sign_in.sign_outs` - Counts sign-outs -* `aspnetcore.identity.sign_in.two_factor_clients_remembered` - Counts remembered two-factor clients -* `aspnetcore.identity.sign_in.two_factor_clients_forgotten` - Counts forgotten two-factor clients +* `aspnetcore.identity.sign_in.authenticate.duration` measures the duration of authentication operations. +* `aspnetcore.identity.sign_in.check_password_attempts` counts password check attempts during sign-in. +* `aspnetcore.identity.sign_in.sign_ins` counts successful sign-ins. +* `aspnetcore.identity.sign_in.sign_outs` counts sign-outs. +* `aspnetcore.identity.sign_in.two_factor_clients_remembered` counts remembered two-factor clients. +* `aspnetcore.identity.sign_in.two_factor_clients_forgotten` counts forgotten two-factor clients. These metrics can be used to: