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
description: Learn how to enable staged rollout of features for targeted audiences.
5
5
ms.service: azure-app-configuration
6
6
ms.devlang: csharp
7
-
author: maud-lv
8
-
ms.author: malev
9
-
ms.topic: conceptual
10
-
ms.date: 02/16/2024
7
+
author: zhiyuanliang
8
+
ms.author: zhiyuanliang
9
+
ms.topic: how-to
10
+
ms.date: 03/05/2024
11
11
---
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. For more information, see [Targeting](https://github.com/microsoft/FeatureManagement-Dotnet#targeting).
15
+
Targeting is a feature management strategy that enables developers to progressively roll out new features to their user base. The strategy is built on the concept of targeting a set of users known as the target audience. An audience is made up of specific users, groups, and a designated percentage of the entire user base.
16
+
17
+
- The users can be actual user accounts, but they can also be machines, devices, or any uniquely identifiable entities to which you want to roll out a feature.
18
+
19
+
- The groups are up to your application to define. They can be Microsoft Entra groups, your workloads at different locations, or any common attributes based on which you want to categorize your audience.
16
20
17
21
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
22
@@ -21,23 +25,125 @@ In this article, you learn how to roll out a new feature in an ASP.NET Core web
21
25
- Finish the [Quickstart: Add feature flags to an ASP.NET Core app](./quickstart-feature-flag-aspnet-core.md).
22
26
- Update the [`Microsoft.FeatureManagement.AspNetCore`](https://www.nuget.org/packages/Microsoft.FeatureManagement.AspNetCore/) package to version **3.0.0** or later.
23
27
24
-
## Create a web application with feature flags and authentication
28
+
## Create a web application with authentication and feature flags
25
29
26
-
To roll out features based on users and groups, you need a web application that allows users to sign in.
30
+
In this section, you will create a web application that allows users to sign in and use the **Beta** feature flag you created before. Most of steps is very similar to what you have done in [Quickstart](./quickstart-feature-flag-aspnet-core.md).
27
31
28
32
1. Create a web application that authenticates against a local database using the following command.
29
33
30
34
```dotnetcli
31
35
dotnet new mvc --auth Individual -o TestFeatureFlags
32
36
```
33
37
34
-
1. Build and run. Then select the **Register** link in the upper right corner to create a new user account. Use an email address of `[email protected]`. On the **Register Confirmation** screen, select **Click here to confirm your account**.
38
+
1. Add references to the following NuGet packages.
1. Build and run. Then select the **Register** link in the upper right corner to create a new user account. Use an email address of `[email protected]`. On the **Register Confirmation** screen, select **Click here to confirm your account**.
37
143
38
144
1. Toggle the feature flag in App Configuration. Validate that this action controls the visibility of the **Beta** item on the navigation bar.
39
145
40
-
## Update the web application code to use TargetingFilter
146
+
## Update the web application code to use `TargetingFilter`
41
147
42
148
At this point, you can use the feature flag to enable or disable the `Beta` feature for all users. To enable the feature flag for some users while disabling it for others, update your code to use `TargetingFilter`. In this example, you use the signed-in user's email address as the user ID, and the domain name portion of the email address as the group. You add the user and group to the `TargetingContext`. The `TargetingFilter` uses this context to determine the state of the feature flag for each request.
43
149
@@ -92,15 +198,7 @@ At this point, you can use the feature flag to enable or disable the `Beta` feat
0 commit comments