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-feature-filters-aspnet-core.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ author: maud-lv
9
9
ms.author: malev
10
10
ms.topic: how-to
11
11
ms.date: 01/12/2024
12
+
#Customerintent: As a developer, I want to create a feature filter to activate a feature flag depending on a specific scenario.
12
13
---
13
14
14
15
# Use feature filters to enable conditional feature flags
@@ -25,6 +26,10 @@ The `Microsoft.FeatureManagement` library includes three feature filters:
25
26
26
27
You can also create your own feature filter that implements the Microsoft.FeatureManagement.IFeatureFilter interface.
27
28
29
+
## Prerequisites
30
+
31
+
- An App Configuration store. [Create a store](./quickstart-azure-app-configuration-create.md#create-an-app-configuration-store).
32
+
28
33
## Register a feature filter
29
34
30
35
You register a feature filter by calling the `AddFeatureFilter` method, specifying the type name of the desired feature filter. For example, the following code registers `PercentageFilter`:
@@ -49,7 +54,7 @@ You can configure these settings for feature flags defined in Azure App Configur
49
54
50
55
:::image type="content" source="./media/feature-filters/edit-beta-feature-flag.png" alt-text="Screenshot of the Azure portal, selecting the Edit option for the Beta feature flag, under Feature manager.":::
51
56
52
-
1. On the Beta feature flag you created in the quickstart, select the context menu and then select**Edit**.
57
+
1. On the line with the Beta feature flag you created in the quickstart, select the context menu and then **Edit**.
53
58
54
59
1. In the **Edit feature flag** pane that opens, check the **Enable feature flag** checkbox if it isn't already enabled. Then check the **Use feature filter** checkbox and select **Create**.
55
60
@@ -60,9 +65,9 @@ You can configure these settings for feature flags defined in Azure App Configur
60
65
:::image type="content" source="./media/feature-filters/add-targeting-filter.png" alt-text="Screenshot of the Azure portal, creating a new targeting filter.":::
61
66
62
67
1. Optionally expand the **Evaluation flow** menu to see a graph showing how the targeting filter is evaluated in the selected scenario. Leave the **Default Percentage** at 50. The options **Override by Groups** and **Override by Users** let you enable or disable the feature flag for select groups or users. These options are disabled by default.
63
-
1. Select **Add** to return to the **Edit feature flag** screen.
68
+
1. Select **Add** to save the new feature filter and return to the **Edit feature flag** screen.
64
69
65
-
1. Select **Apply** again to save the new feature flag settings.
70
+
1.The feature filter you created is now listed in the feature flag details. Select **Apply** to save the new feature flag settings.
66
71
67
72
:::image type="content" source="./media/feature-filters/feature-flag-edit-apply-filter.png" alt-text="Screenshot of the Azure portal, applying new targeting filter.":::
68
73
@@ -74,8 +79,7 @@ You can configure these settings for feature flags defined in Azure App Configur
74
79
75
80
To see the effects of this feature flag, launch the application and hit the **Refresh** button in your browser multiple times. You'll see that the *Beta* item appears on the toolbar about 50% of the time. It's hidden the rest of the time, because the `PercentageFilter` deactivates the *Beta* feature for a subset of requests. The following video shows this behavior in action.
76
81
77
-
> [!div class="mx-imgBorder"]
78
-
> 
82
+
:::image type="content" source="./media/feature-filters/feature-flags-percentagefilter.gif" alt-text="Screenshot of a web browser showing a targeting filter in action.":::
0 commit comments