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
+86-5Lines changed: 86 additions & 5 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 a 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).
16
16
17
17
## Prerequisites
18
18
@@ -31,22 +31,101 @@ In this section, you will create a web application that allows users to sign in
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.
35
35
36
+
```dotnetcli
37
+
cd TestFeatureFlags
38
+
```
39
+
40
+
1. Connect to your App Configuration store using Microsoft Entra ID (recommended), or a connection string.
41
+
42
+
### [Microsoft Entra ID (recommended)](#tab/entra-id)
1. Run the following command to restore packages for your project:
63
+
64
+
```dotnetcli
65
+
dotnet restore
66
+
```
67
+
68
+
1. Create a user secret for the application by navigating into the *TestFeatureFlags* folder and running the following command.
69
+
70
+
### [Microsoft Entra ID (recommended)](#tab/entra-id)
71
+
72
+
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.
73
+
74
+
```dotnetcli
75
+
dotnet user-secrets init
76
+
dotnet user-secrets set Endpoints:AppConfiguration "<your-App-Configuration-endpoint>"
77
+
```
78
+
79
+
### [Connection string](#tab/connection-string)
40
80
41
-
1. Store the connection string for your App Configuration store.
81
+
The command uses [Secret Manager](/aspnet/core/security/app-secrets) to store a secret named `ConnectionStrings:AppConfig`, which stores the connection string for your App Configuration store. Replace the `<your_connection_string>` placeholder with your App Configuration store's connection string. You can find the connection string in your App Configuration store's **Access settings** in the Azure portal.
42
82
43
83
```dotnetcli
44
84
dotnet user-secrets init
45
85
dotnet user-secrets set ConnectionStrings:AppConfig "<your_connection_string>"
46
86
```
87
+
---
47
88
48
89
1. Add Azure App Configuration and feature management to your application.
49
90
91
+
### [Microsoft Entra ID (recommended)](#tab/entra-id)
92
+
93
+
Update the *Program.cs* file with the following code.
94
+
95
+
``` C#
96
+
// Existing code in Program.cs
97
+
// ... ...
98
+
99
+
using Azure.Identity;
100
+
101
+
var builder = WebApplication.CreateBuilder(args);
102
+
103
+
// Load configuration from Azure App Configuration
0 commit comments