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/reference-dotnet-provider.md
+33-22Lines changed: 33 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -159,7 +159,7 @@ You can create JSON key-values in App Configuration. For more information, go to
159
159
160
160
### Load specific key-values using selectors
161
161
162
-
By default, the configuration provider will load all key-values with no label from the App Configuration. You can selectively load key-values from your App Configuration store by calling `Select` method on `AzureAppConfigurationOptions`.
162
+
By default, the configuration provider loads all key-values with no label from the App Configuration. You can selectively load key-values from your App Configuration store by calling `Select` method on `AzureAppConfigurationOptions`.
163
163
164
164
```csharp
165
165
builder.AddAzureAppConfiguration(options=>
@@ -181,7 +181,7 @@ The `Select` method takes two parameters, the first parameter is a key filter th
181
181
182
182
The key filter parameter determines which configuration keys to include:
183
183
184
-
-**Exact match**: Using a specific string will match only keys that exactly match the filter.
184
+
-**Exact match**: Using a specific string matches only keys that exactly match the filter.
185
185
-**Prefix match**: Adding an asterisk (`*`) at the end creates a prefix filter (e.g., `App:Settings:*` loads all keys starting with "App:Settings:").
186
186
-**Multiple key selection**: Using a comma (`,`) allows selection of multiple explicit keys (e.g., `Key1,Key2,Key3`).
187
187
-**Reserved characters**: The characters asterisk (`*`), comma (`,`), and backslash (`\`) are reserved and must be escaped with a backslash when used in key names (e.g. the key filter `a\\b\,\*c*` returns all key-values whose key starts with `a\b,*c`.).
@@ -191,7 +191,7 @@ The key filter parameter determines which configuration keys to include:
191
191
192
192
#### Label filter
193
193
194
-
The label filter parameter selects key-values with a specific label. If not specified, the built-in `LabelFilter.Null`will be used.
194
+
The label filter parameter selects key-values with a specific label. If not specified, the built-in `LabelFilter.Null`is used.
195
195
196
196
> [!NOTE]
197
197
> The characters asterisk (`*`) and comma (`,`), are not supported for label filter. Backslash (`\`) character is reserved and must be escaped using another backslash (`\`).
The `builder.Services.AddAzureAppConfiguration()`add the `IConfigurationRefreshProvider` service to the DI container. It will give you the access to the refreshers of all Azure App Configuration sources in the application's configuration.
316
+
`builder.Services.AddAzureAppConfiguration()`adds the `IConfigurationRefreshProvider` service to the DI container, which gives you access to the refreshers of all Azure App Configuration sources in the application's configuration.
317
317
318
318
```csharp
319
319
publicclassWorker : BackgroundService
@@ -347,12 +347,12 @@ You can use the `Microsoft.Azure.AppConfiguration.AspNetCore` package to use the
The middleware will call the `TryRefreshAsync` method on the registered `IConfigurationRefresher` when there are new incoming requests to your application.
350
+
The middleware calls the `TryRefreshAsync` method on the registered `IConfigurationRefresher` when there are new incoming requests to your application.
351
351
352
352
```csharp
353
353
varapp=builder.Build();
354
354
355
-
// Call the app.UseAzureAppConfiguration() method as early as appropriate in your request pipeline so another middleware won't skip it
355
+
// Call the app.UseAzureAppConfiguration() method as early as appropriate in your request pipeline so another middleware doesn't skip it
356
356
app.UseAzureAppConfiguration();
357
357
358
358
// Continue with other middleware registration
@@ -362,11 +362,11 @@ app.UseRouting();
362
362
```
363
363
364
364
> [!NOTE]
365
-
> Even if the refresh call fails for any reason, your application will continue to use the cached configuration. Another attempt will be made when the configured refresh interval has passed and the refresh call is triggered by your application activity. Calling refresh is a no-op before the configured refresh interval elapses, so its performance impact is minimal even if it's called frequently.
365
+
> Even if the refresh call fails for any reason, your application continues to use the cached configuration. Another attempt is made when the configured refresh interval has passed and the refresh call is triggered by your application activity. Calling refresh is a no-op before the configured refresh interval elapses, so its performance impact is minimal even if it's called frequently.
366
366
367
367
### Refresh on sentinel key
368
368
369
-
A sentinel key is a key that you update after you complete the change of all other keys. The configuration provider will monitor the sentinel key instead of all selected key-values. When a change is detected, your app refreshes all configuration values.
369
+
A sentinel key is a key that you update after you complete the change of all other keys. The configuration provider monitors the sentinel key instead of all selected key-values. When a change is detected, your app refreshes all configuration values.
370
370
371
371
This approach is useful when updating multiple key-values. By updating the sentinel key only after all other configuration changes are completed, you ensure your application reloads configuration just once, maintaining consistency.
Inside the `UseFeatureFlags` method, you call the `Select` method to selectively load feature flags. You can use [key filter](#key-filter) and [label filter](#label-filter) to select the feature flags you want to load. If no `Select` method is called, `UseFeatureFlags`will load all feature flags with no label by default.
408
+
Inside the `UseFeatureFlags` method, you call the `Select` method to selectively load feature flags. You can use [key filter](#key-filter) and [label filter](#label-filter) to select the feature flags you want to load. If no `Select` method is called, `UseFeatureFlags`loads all feature flags with no label by default.
409
409
410
-
Different from key-values, feature flags will be automatically registered for refresh without requiring explicit `ConfigureRefresh` call. You can specify the minimum time between feature flag refreshes through the `SetRefreshInterval` method. The default refresh interval is 30 seconds.
410
+
Different from key-values, feature flags are automatically registered for refresh without requiring explicit `ConfigureRefresh` call. You can specify the minimum time between feature flag refreshes through the `SetRefreshInterval` method. The default refresh interval is 30 seconds.
411
411
412
-
### Feature Management
412
+
### Feature management
413
413
414
414
Feature management library provides a way to develop and expose application functionality based on feature flags. The feature management library is designed to work in conjunction with the configuration provider library. Install the [`Microsoft.FeatureManagement`](./feature-management-dotnet-reference.md) package:
415
415
@@ -468,7 +468,7 @@ For more information about how to use the feature management library, go to the
468
468
469
469
Azure App Configuration supports referencing secrets stored in Azure Key Vault. In App Configuration, you can create keys that map to secrets stored in Key Vault. The secrets are securely stored in Key Vault, but can be accessed like any other configuration once loaded.
470
470
471
-
The configuration provider library retrieves Key Vault references, just as it does for any other keys stored in App Configuration. Because the client recognizes the keys as Key Vault references, they have a unique content-type, and the client will connect to Key Vault to retrieve their values for your application.
471
+
The configuration provider library retrieves Key Vault references, just as it does for any other keys stored in App Configuration. Because the client recognizes the keys as Key Vault references, they have a unique content-type, and the client connects to Key Vault to retrieve their values for your application.
472
472
473
473
### Connect to Key Vault
474
474
@@ -480,7 +480,7 @@ using Azure.Security.KeyVault.Secrets;
You can also call `SetSecretResolver` to add a custom secret resolver which will be used when no registered `SecretClient` is available or the provided credential fails to authenticate to Key Vault. This method accepts a delegate function that resolves a Key Vault URI to a secret value. The following example demostrates using a secret resolver to retrieve secret from environment variables in development.
498
+
You can also call `SetSecretResolver` to add a custom secret resolver which is used when no registered `SecretClient` is available or the provided credential fails to authenticate to Key Vault. This method accepts a delegate function that resolves a Key Vault URI to a secret value. The following example demostrates using a secret resolver to retrieve secret from environment variables in development and use fallback value when fail to get secret from the Key Vault.
> If your application loads key-values containing Key Vault references without proper Key Vault configuration, an exception will be thrown at startup. Ensure you've properly configured Key Vault access or secret resolver.
533
+
> If your application loads key-values containing Key Vault references without proper Key Vault configuration, an **exception** will be thrown at startup. Ensure you've properly configured Key Vault access or secret resolver.
534
+
535
+
> [!TIP]
536
+
> You can use a custom secret resolver to handle cases where Key Vault references are accidentally added to your App Configuration store. The resolver can provide fallback values, log warnings, or gracefully handle missing proper credential to access Key Vault instead of throwing exceptions.
526
537
527
538
### Key Vault secret refresh
528
539
@@ -565,7 +576,7 @@ You can call `SelectSnapshot` to load key-values from a snapshot.
0 commit comments