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/use-variant-feature-flags-aspnet-core.md
+16-11Lines changed: 16 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
-
title: 'Tutorial: Use variant feature flags from Azure App Configuration in an ASP.NET application'
2
+
title: 'Tutorial: Use variant feature flags from Azure App Configuration in an ASP.NET Core application'
3
3
titleSuffix: Azure App configuration
4
-
description: In this tutorial, you learn how to use variant feature flags in an ASP.NET application
4
+
description: In this tutorial, you learn how to use variant feature flags in an ASP.NET Core application
5
5
#customerintent: As a user of Azure App Configuration, I want to learn how I can use variants and variant feature flags in my ASP.NET application.
6
6
author: rossgrambo
7
7
ms.author: rossgrambo
@@ -11,7 +11,7 @@ ms.topic: tutorial
11
11
ms.date: 10/18/2024
12
12
---
13
13
14
-
# Tutorial: Use variant feature flags from Azure App Configuration in an ASP.NET application
14
+
# Tutorial: Use variant feature flags from Azure App Configuration in an ASP.NET Core application
15
15
16
16
In this tutorial, you use a variant feature flag to manage experiences for different user segments in an example application, *Quote of the Day*. You utilize the variant feature flag created in [Use variant feature flags](./use-variant-feature-flags.md). Before proceeding, ensure you create the variant feature flag named *Greeting* in your App Configuration store.
17
17
@@ -28,10 +28,11 @@ In this tutorial, you use a variant feature flag to manage experiences for diffe
28
28
dotnet new razor --auth Individual -o QuoteOfTheDay
29
29
```
30
30
31
-
1. Create a [user secret](/aspnet/core/security/app-secrets) for the application by navigating into the *QuoteOfTheDay* folder and run the following command. This secret holds the endpoint for your App Configuration.
31
+
1. Create a [user secret](/aspnet/core/security/app-secrets) for the application by navigating into the *QuoteOfTheDay* folder and run the following commands. This secret holds the endpoint for your App Configuration store.
32
32
33
33
```dotnetcli
34
-
dotnet user-secrets set Endpoints:AppConfiguration "<App Configuration Endpoint>"
34
+
dotnet user-secrets init
35
+
dotnet user-secrets set Endpoints:AppConfiguration "<Your App Configuration store endpoint>"
35
36
```
36
37
37
38
1. Add the latest versions of the required packages.
@@ -44,26 +45,30 @@ In this tutorial, you use a variant feature flag to manage experiences for diffe
44
45
45
46
## Connect to App Configuration for feature management
46
47
47
-
1. In *Program.cs*, add the following using statements.
48
+
1. Open *Program.cs*, and add the following using statements.
48
49
49
50
```csharp
50
51
using Azure.Identity;
51
52
using Microsoft.Extensions.Configuration.AzureAppConfiguration;
52
53
using Microsoft.FeatureManagement;
53
54
```
54
55
55
-
1. In *Program.cs*, under the line `var builder = WebApplication.CreateBuilder(args);`, add the App Configuration provider, which pulls down the configuration from Azure App Configuration when the application starts. By default, the `UseFeatureFlags` method pulls down all feature flags with no label.
56
+
1. Add the following code to connect to your App Configuration store and call `UseFeatureFlags` to pull down all feature flags with no label.
56
57
57
58
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.
0 commit comments