Skip to content

Commit 48f78c6

Browse files
Merge pull request #291237 from maud-lv/ml-ffdotnetbackground2
Add Entra ID to quickstart-feature-flag-dotnet-background-service.md
2 parents da0d509 + a1937b5 commit 48f78c6

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

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

Lines changed: 27 additions & 1 deletion
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/19/2024
12+
ms.date: 12/17/2024
1313
ms.author: zhiyuanliang
1414
#Customer intent: As a .NET background service developer, I want to use feature flags to control feature availability quickly and confidently.
1515
---
@@ -52,10 +52,35 @@ Add a feature flag called *Beta* to the App Configuration store and leave **Labe
5252
5353
1. Add a call to the `UseFeatureFlags` method inside the `AddAzureAppConfiguration` call and register feature management services.
5454
55+
### [Microsoft Entra ID (recommended)](#tab/entra-id)
56+
5557
```csharp
5658
// Existing code in Program.cs
5759
// ... ...
60+
builder.Configuration.AddAzureAppConfiguration(options =>
61+
{
62+
string endpoint = Environment.GetEnvironmentVariable("Endpoint");
63+
options.Connect(new Uri(endpoint), new DefaultAzureCredential());
64+
65+
// Use feature flags
66+
options.UseFeatureFlags();
5867
68+
// Register the refresher so that the Worker service can consume it through dependency injection
69+
builder.Services.AddSingleton(options.GetRefresher());
70+
});
71+
72+
// Register feature management services
73+
builder.Services.AddFeatureManagement();
74+
75+
// The rest of existing code in Program.cs
76+
// ... ...
77+
```
78+
79+
### [Connection string](#tab/connection-string)
80+
81+
```csharp
82+
// Existing code in Program.cs
83+
// ... ...
5984
builder.Configuration.AddAzureAppConfiguration(options =>
6085
{
6186
options.Connect(Environment.GetEnvironmentVariable("ConnectionString"));
@@ -73,6 +98,7 @@ Add a feature flag called *Beta* to the App Configuration store and leave **Labe
7398
// The rest of existing code in Program.cs
7499
// ... ...
75100
```
101+
---
76102
77103
> [!TIP]
78104
> 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)