Skip to content

Commit ff44b8e

Browse files
committed
Add Entra ID tab to ASP.Net dynamic config doc and feature flag quickstart
1 parent 987dcc9 commit ff44b8e

File tree

2 files changed

+52
-8
lines changed

2 files changed

+52
-8
lines changed

articles/azure-app-configuration/enable-dynamic-configuration-aspnet-core.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: zhenlan
66
ms.service: azure-app-configuration
77
ms.devlang: csharp
88
ms.topic: tutorial
9-
ms.date: 02/20/2024
9+
ms.date: 11/27/2024
1010
ms.author: zhenlwa
1111
ms.custom: devx-track-csharp
1212
---
@@ -35,8 +35,28 @@ A *sentinel key* is a key that you update after you complete the change of all o
3535

3636
## Reload data from App Configuration
3737

38-
1. Open *Program.cs*, and update the `AddAzureAppConfiguration` method you added previously during the quickstart.
38+
1. Open *Program.cs*, and update the `AddAzureAppConfiguration` method you added previously during the quickstart. Connect to App Configuration using Microsoft Entra ID (recommended), or a connection string.
3939

40+
### [Microsoft Entra ID (recommended)](#tab/entra-id)
41+
42+
You use the `DefaultAzureCredential` to authenticate to your App Configuration store. While completing the quickstart listed in the prerequisites, you already [assigned your credential the **App Configuration Data Reader role**](./concept-enable-rbac.md#authentication-with-token-credentials).
43+
44+
```csharp
45+
// Load configuration from Azure App Configuration
46+
builder.Configuration.AddAzureAppConfiguration(options =>
47+
{
48+
string endpoint = builder.Configuration.Get("Endpoints:AppConfiguration");
49+
options.Connect(new Uri(endpoint), new DefaultAzureCredential());
50+
// Load all keys that start with `TestApp:` and have no label
51+
.Select("TestApp:*", LabelFilter.Null)
52+
// Configure to reload configuration if the registered sentinel key is modified
53+
.ConfigureRefresh(refreshOptions =>
54+
refreshOptions.Register("TestApp:Settings:Sentinel", refreshAll: true));
55+
});
56+
```
57+
58+
### [Connection string](#tab/connection-string)
59+
4060
```csharp
4161
// Load configuration from Azure App Configuration
4262
builder.Configuration.AddAzureAppConfiguration(options =>
@@ -49,6 +69,7 @@ A *sentinel key* is a key that you update after you complete the change of all o
4969
refreshOptions.Register("TestApp:Settings:Sentinel", refreshAll: true));
5070
});
5171
```
72+
---
5273

5374
The `Select` method is used to load all key-values whose key name starts with *TestApp:* and that have *no label*. You can call the `Select` method more than once to load configurations with different prefixes or labels. If you share one App Configuration store with multiple apps, this approach helps load configuration only relevant to your current app instead of loading everything from your store.
5475

articles/azure-app-configuration/quickstart-feature-flag-aspnet-core.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.service: azure-app-configuration
88
ms.devlang: csharp
99
ms.custom: devx-track-csharp, mode-other
1010
ms.topic: quickstart
11-
ms.date: 02/20/2024
11+
ms.date: 11/27/2024
1212
ms.author: zhenlwa
1313
#Customer intent: As an ASP.NET Core developer, I want to use feature flags to control feature availability quickly and confidently.
1414
---
@@ -41,23 +41,46 @@ Add a feature flag called *Beta* to the App Configuration store (created in the
4141
dotnet add package Microsoft.FeatureManagement.AspNetCore
4242
```
4343
44-
1. Open *Program.cs*, and add a call to the `UseFeatureFlags` method inside the `AddAzureAppConfiguration` call.
44+
1. Open *Program.cs*, and add a call to the `UseFeatureFlags` method inside the `AddAzureAppConfiguration` call. Connect to App Configuration using Microsoft Entra ID (recommended), or a connection string.
4545
46+
### [Microsoft Entra ID (recommended)](#tab/entra-id)
47+
48+
```csharp
49+
// Load configuration from Azure App Configuration
50+
builder.Configuration.AddAzureAppConfiguration(options =>
51+
{
52+
string endpoint = builder.Configuration.Get("Endpoints:AppConfiguration");
53+
options.Connect(new Uri(endpoint), new DefaultAzureCredential());
54+
55+
// Load all keys that start with `TestApp:` and have no label
56+
.Select("TestApp:*", LabelFilter.Null)
57+
// Configure to reload configuration if the registered sentinel key is modified
58+
.ConfigureRefresh(refreshOptions =>
59+
refreshOptions.Register("TestApp:Settings:Sentinel", refreshAll: true));
60+
61+
// Load all feature flags with no label
62+
options.UseFeatureFlags();
63+
});
64+
```
65+
66+
### [Connection string](#tab/connection-string)
67+
4668
```csharp
4769
// Load configuration from Azure App Configuration
4870
builder.Configuration.AddAzureAppConfiguration(options =>
4971
{
5072
options.Connect(connectionString)
51-
// Load all keys that start with `TestApp:` and have no label
52-
.Select("TestApp:*", LabelFilter.Null)
53-
// Configure to reload configuration if the registered sentinel key is modified
54-
.ConfigureRefresh(refreshOptions =>
73+
// Load all keys that start with `TestApp:` and have no label
74+
.Select("TestApp:*", LabelFilter.Null)
75+
// Configure to reload configuration if the registered sentinel key is modified
76+
.ConfigureRefresh(refreshOptions =>
5577
refreshOptions.Register("TestApp:Settings:Sentinel", refreshAll: true));
5678
5779
// Load all feature flags with no label
5880
options.UseFeatureFlags();
5981
});
6082
```
83+
---
6184
6285
> [!TIP]
6386
> When no parameter is passed to the `UseFeatureFlags` method, it loads *all* feature flags with *no label* in your App Configuration store. The default refresh interval of feature flags is 30 seconds. You can customize this behavior via the `FeatureFlagOptions` parameter. For example, the following code snippet loads only feature flags that start with *TestApp:* in their *key name* and have the label *dev*. The code also changes the refresh interval time to 5 minutes. Note that this refresh interval time is separate from that for regular key-values.

0 commit comments

Comments
 (0)