Skip to content

Commit 5f67917

Browse files
committed
Revert changes to quickstart-
feature-flag-dotnet.md to match upstream main
1 parent 4577904 commit 5f67917

File tree

1 file changed

+14
-95
lines changed

1 file changed

+14
-95
lines changed

articles/azure-app-configuration/quickstart-feature-flag-dotnet.md

Lines changed: 14 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.devlang: csharp
99
ms.custom: devx-track-csharp, mode-other, devx-track-dotnet
1010
ms.topic: quickstart
1111
ms.tgt_pltfrm: .NET
12-
ms.date: 2/13/2025
12+
ms.date: 2/19/2024
1313
ms.author: zhiyuanliang
1414
#Customer intent: As a .NET developer, I want to use feature flags to control feature availability quickly and confidently.
1515
---
@@ -63,68 +63,9 @@ You can use Visual Studio to create a new console app project.
6363
using Microsoft.FeatureManagement;
6464
```
6565
66-
1. Update *Program.cs*. to connect to your App Configuration store using Microsoft Entra ID (recommended) or a connection string, and specify the `UseFeatureFlags` option so that feature flags are retrieved. Create a `ConfigurationFeatureDefinitionProvider` to provide feature flag definition from the configuration and a `FeatureManager` to evaluate feature flags' state. Then display a message if the `Beta` feature flag is enabled.
66+
1. Connect to App Configuration, specifying the `UseFeatureFlags` option so that feature flags are retrieved. Create a `ConfigurationFeatureDefinitionProvider` to provide feature flag definition from the configuration and a `FeatureManager` to evaluate feature flags' state. Then display a message if the `Beta` feature flag is enabled.
6767
68-
### [Microsoft Entra ID (recommended)](#tab/entra-id)
69-
70-
You use the `DefaultAzureCredential` to authenticate to your App Configuration store by default. 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.
71-
72-
#### .NET
73-
74-
```csharp
75-
IConfiguration configuration = new ConfigurationBuilder()
76-
.AddAzureAppConfiguration(options =>
77-
{
78-
string endpoint = Environment.GetEnvironmentVariable("Endpoint");
79-
options.Connect(new Uri(endpoint), new DefaultAzureCredential());
80-
.UseFeatureFlags();
81-
}).Build();
82-
83-
IFeatureDefinitionProvider featureDefinitionProvider = new ConfigurationFeatureDefinitionProvider(configuration);
84-
85-
IVariantFeatureManager featureManager = new FeatureManager(
86-
featureDefinitionProvider,
87-
new FeatureManagementOptions());
88-
89-
if (await featureManager.IsEnabledAsync("Beta"))
90-
{
91-
Console.WriteLine("Welcome to the beta!");
92-
}
93-
94-
Console.WriteLine("Hello World!");
95-
```
96-
97-
#### .NET Framework
98-
99-
```csharp
100-
public static async Task Main(string[] args)
101-
{
102-
IConfiguration configuration = new ConfigurationBuilder()
103-
.AddAzureAppConfiguration(options =>
104-
{
105-
string endpoint = Environment.GetEnvironmentVariable("Endpoint");
106-
options.Connect(new Uri(endpoint), new DefaultAzureCredential());
107-
.UseFeatureFlags();
108-
}).Build();
109-
110-
IFeatureDefinitionProvider featureDefinitionProvider = new ConfigurationFeatureDefinitionProvider(configuration);
111-
112-
IVariantFeatureManager featureManager = new FeatureManager(
113-
featureDefinitionProvider,
114-
new FeatureManagementOptions());
115-
116-
if (await featureManager.IsEnabledAsync("Beta"))
117-
{
118-
Console.WriteLine("Welcome to the beta!");
119-
}
120-
121-
Console.WriteLine("Hello World!");
122-
}
123-
```
124-
125-
### [Connection string](#tab/connection-string)
126-
127-
#### .NET
68+
### [.NET](#tab/dotnet)
12869
12970
```csharp
13071
IConfiguration configuration = new ConfigurationBuilder()
@@ -148,7 +89,7 @@ You can use Visual Studio to create a new console app project.
14889
Console.WriteLine("Hello World!");
14990
```
15091
151-
#### .NET Framework
92+
### [.NET Framework](#tab/dotnet-framework)
15293
15394
```csharp
15495
public static async Task Main(string[] args)
@@ -174,53 +115,31 @@ You can use Visual Studio to create a new console app project.
174115
Console.WriteLine("Hello World!");
175116
}
176117
```
118+
177119
---
178120
179121
## Build and run the app locally
180122
181-
1. Set an environment variable.
182-
183-
### [Microsoft Entra ID (recommended)](#tab/entra-id)
184-
185-
Set an environment variable named **Endpoint** to the endpoint of your App Configuration store found under the **Overview** of your store in the Azure portal.
186-
187-
If you use the Windows command prompt, run the following command and restart the command prompt to allow the change to take effect:
188-
189-
```cmd
190-
setx Endpoint "<endpoint-of-your-app-configuration-store>"
191-
```
192-
193-
If you use PowerShell, run the following command:
123+
1. Set an environment variable named **ConnectionString** to the connection string of your App Configuration store.
194124
195-
```powershell
196-
$Env:Endpoint = "<endpoint-of-your-app-configuration-store>"
197-
```
125+
### [Windows command prompt](#tab/windowscommandprompt)
198126
199-
If you use macOS or Linux, run the following command:
127+
If you use the Windows command prompt, run the following command.
200128
201-
```bash
202-
export Endpoint='<endpoint-of-your-app-configuration-store>'
129+
```console
130+
setx ConnectionString "<connection-string-of-your-app-configuration-store>"
203131
```
204132
205-
### [Connection string](#tab/connection-string)
133+
Restart the command prompt to allow the change to take effect. Validate that it's set properly by printing the value of the environment variable.
206134
207-
Set an environment variable named **ConnectionString** to the read-only connection string of your App Configuration store found under **Access settings** of your store in the Azure portal.
135+
### [PowerShell](#tab/powershell)
208136
209-
If you use the Windows command prompt, run the following command:
137+
If you use Windows PowerShell, run the following command.
210138
211-
```console
212-
setx ConnectionString "<connection-string-of-your-app-configuration-store>"
213-
```
214-
If you use Windows PowerShell, run the following command:
215-
```powershell
139+
```azurepowershell
216140
$Env:ConnectionString = "<connection-string-of-your-app-configuration-store>"
217141
```
218142
219-
If you use macOS or Linux, run the following command:
220-
221-
```bash
222-
export ConnectionString='<connection-string-of-your-app-configuration-store>'
223-
```
224143
---
225144
226145
1. Restart Visual Studio to allow the change to take effect.

0 commit comments

Comments
 (0)