You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-app-configuration/howto-targetingfilter-aspnet-core.md
+18-29Lines changed: 18 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,14 +12,14 @@ ms.date: 02/16/2024
12
12
13
13
# Enable staged rollout of features for targeted audiences
14
14
15
-
Feature flags allow you to dynamically activate or deactivate functionality in your application. Feature filters determine the state of a feature flag each time it's evaluated. The `Microsoft.FeatureManagement` library includes `TargetingFilter`, which enables a feature flag for a specified list of users and groups, or for a specified percentage of users. `TargetingFilter` is "sticky." This means that once an individual user receives a feature, they'll continue to see that feature on all future requests. You can use `TargetingFilter` to enable a feature for a specific account during a demo, to progressively roll out new features to users in different groups or "rings," and much more.
15
+
Feature flags allow you to dynamically activate or deactivate functionality in your application. Feature filters determine the state of a feature flag each time it's evaluated. The `Microsoft.FeatureManagement` library includes `TargetingFilter`, which enables a feature flag for a specified list of users and groups, or for a specified percentage of users. `TargetingFilter` is "sticky." This means that once an individual user receives a feature, they'll continue to see that feature on all future requests. You can use `TargetingFilter` to enable a feature for a specific account during a demo, to progressively roll out new features to users in different groups or "rings," and much more. For more information, see [Targeting](https://github.com/microsoft/FeatureManagement-Dotnet#targeting).
16
16
17
17
In this article, you learn how to roll out a new feature in an ASP.NET Core web application to specified users and groups, using `TargetingFilter` with Azure App Configuration.
18
18
19
19
## Prerequisites
20
20
21
21
- Finish the [Quickstart: Add feature flags to an ASP.NET Core app](./quickstart-feature-flag-aspnet-core.md).
22
-
- Update the `Microsoft.FeatureManagement.AspNetCore` package to version **2.6.0** or later.
22
+
- Update the [`Microsoft.FeatureManagement.AspNetCore`](https://www.nuget.org/packages/Microsoft.FeatureManagement.AspNetCore/) package to version **3.0.0** or later.
23
23
24
24
## Create a web application with feature flags and authentication
25
25
@@ -92,48 +92,37 @@ At this point, you can use the feature flag to enable or disable the `Beta` feat
1. Register `TargetingFilter` and `TestTargetingContextAccessor` createdintheearliersteptotheservicecollection. The`TargetingFilter`willusethe`TestTargetingContextAccessor`todeterminethetargetingcontexteverytimethatthefeatureflagisevaluated.
102
102
103
-
```csharp
104
-
services.AddFeatureManagement()
105
-
.AddFeatureFilter<TargetingFilter>();
106
-
```
107
-
108
-
> [!NOTE]
109
-
>ForBlazorapplications, see [instructions](./faq.yml#how-to-enable-feature-management-in-blazor-applications-or-as-scoped-services-in--net-applications) for enabling feature management as scoped services.
1. Update the *ConfigureServices* method to add the `TestTargetingContextAccessor` created in the earlier step to the service collection. The *TargetingFilter* uses it to determine the targeting context every time that the feature flag is evaluated.
105
+
Since `Microsoft.FeatureManagement` 3.0.0, youcanuse `WithTargeting` methodtoregister `TargetingFilter` and `ITargetingContextAccessor` atthesametime.
>ForBlazorapplications, see [instructions](./faq.yml#how-to-enable-feature-management-in-blazor-applications-or-as-scoped-services-in--net-applications) for enabling feature management as scoped services.
125
+
137
126
## Update the feature flag to use TargetingFilter
138
127
139
128
1. In the Azure portal, go to your App Configuration store and select **Feature manager**.
0 commit comments