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
+77-12Lines changed: 77 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,12 @@ ms.devlang: csharp
7
7
author: zhiyuanliang-ms
8
8
ms.author: zhiyuanliang
9
9
ms.topic: how-to
10
-
ms.date: 03/26/2024
10
+
ms.date: 12/02/2024
11
11
---
12
12
13
13
# Roll out features to targeted audiences in an ASP.NET Core application
14
14
15
-
In this guide, you'll use the targeting filter to roll out a feature to targeted audience for your ASP.NET Core application. For more information about the targeting filter, see [Roll out features to targeted audiences](./howto-targetingfilter.md).
15
+
In this guide, you'll use the targeting filter to roll out a feature to targeted audiences for your ASP.NET Core application. For more information about the targeting filter, see [Roll out features to targeted audiences](./howto-targetingfilter.md).
16
16
17
17
## Prerequisites
18
18
@@ -23,30 +23,92 @@ In this guide, you'll use the targeting filter to roll out a feature to targeted
23
23
24
24
## Create a web application with a feature flag
25
25
26
-
In this section, you will create a web application that allows users to sign in and use the *Beta* feature flag you created before.
26
+
In this section, you create a web application that allows users to sign in and use the *Beta* feature flag you created before.
27
27
28
28
1. Create a web application that authenticates against a local database using the following command.
29
29
30
30
```dotnetcli
31
31
dotnet new webapp --auth Individual -o TestFeatureFlags
32
32
```
33
33
34
-
1. Add references to the following NuGet packages.
34
+
1. Navigate to the newly created *TestFeatureFlags* directory and add references to the following NuGet packages.
35
+
36
+
### [Microsoft Entra ID (recommended)](#tab/entra-id)
1. Create a user secret for the application by running the following commands.
53
+
54
+
### [Microsoft Entra ID (recommended)](#tab/entra-id)
55
+
56
+
The command uses [Secret Manager](/aspnet/core/security/app-secrets) to store a secret named `Endpoints:AppConfiguration`, which stores the endpoint for your App Configuration store. Replace the `<your-App-Configuration-endpoint>` placeholder with your App Configuration store's endpoint. You can find the endpoint in your App Configuration store's **Overview** blade in the Azure portal.
57
+
58
+
```dotnetcli
59
+
dotnet user-secrets init
60
+
dotnet user-secrets set Endpoints:AppConfiguration "<your-App-Configuration-endpoint>"
61
+
```
40
62
41
-
1. Store the connection string for your App Configuration store.
63
+
### [Connection string](#tab/connection-string)
64
+
65
+
The command uses [Secret Manager](/aspnet/core/security/app-secrets) to store a secret named `ConnectionStrings:AppConfiguration`, which stores the connection string for your App Configuration store. Replace the `<your-App-Configuration-connection-string>` placeholder with your App Configuration store's read-only connection string. You can find the connection string in your App Configuration store's **Access settings** in the Azure portal.
42
66
43
67
```dotnetcli
44
68
dotnet user-secrets init
45
-
dotnet user-secrets set ConnectionStrings:AppConfig "<your_connection_string>"
69
+
dotnet user-secrets set ConnectionStrings:AppConfiguration "<your-App-Configuration-connection-string>"
46
70
```
71
+
---
47
72
48
73
1. Add Azure App Configuration and feature management to your application.
49
74
75
+
### [Microsoft Entra ID (recommended)](#tab/entra-id)
76
+
77
+
1. You use the `DefaultAzureCredential` to authenticate to your App Configuration store. Follow the [instructions](./concept-enable-rbac.md#authentication-with-token-credentials) to assign your credential the **App Configuration Data Reader** role. Be sure to allow sufficient time for the permission to propagate before running your application.
78
+
79
+
1. Update the *Program.cs* file with the following code.
0 commit comments