Skip to content

Commit 3d3c4d7

Browse files
Add AddAzureAppConfiguration overload to take endpoint and entra id (#694)
* add overload to take endpoint and credential * enrich comment for intellisense * update comment to point to use options.connect pattern * update
1 parent ffc1fbd commit 3d3c4d7

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

src/Microsoft.Extensions.Configuration.AzureAppConfiguration/AzureAppConfigurationExtensions.cs

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33
//
4+
using Azure.Core;
45
using Microsoft.Extensions.Configuration.AzureAppConfiguration;
56
using Microsoft.Extensions.DependencyInjection;
67
using Microsoft.Extensions.DependencyInjection.Extensions;
@@ -30,7 +31,10 @@ private static bool IsProviderDisabled()
3031
}
3132

3233
/// <summary>
33-
/// Adds key-value data from an Azure App Configuration store to a configuration builder.
34+
/// Adds key-value data from an Azure App Configuration store to a configuration builder using its connection string.
35+
/// This is a simplified overload that loads all key-values with no label. For advanced scenarios such as selecting specific keys,
36+
/// filtering by labels, configuring refresh, using feature flags, or resolving Key Vault references,
37+
/// use the overload that accepts an <see cref="Action{AzureAppConfigurationOptions}"/> parameter with options.Connect().
3438
/// </summary>
3539
/// <param name="configurationBuilder">The configuration builder to add key-values to.</param>
3640
/// <param name="connectionString">The connection string used to connect to the configuration store.</param>
@@ -47,7 +51,10 @@ public static IConfigurationBuilder AddAzureAppConfiguration(
4751
}
4852

4953
/// <summary>
50-
/// Adds key-value data from an Azure App Configuration store to a configuration builder.
54+
/// Adds key-value data from a primary Azure App Configuration store and one or more replica stores to a configuration builder using connection strings.
55+
/// This is a simplified overload that loads all key-values with no label. For advanced scenarios such as selecting specific keys,
56+
/// filtering by labels, configuring refresh, using feature flags, or resolving Key Vault references,
57+
/// use the overload that accepts an <see cref="Action{AzureAppConfigurationOptions}"/> parameter with options.Connect().
5158
/// </summary>
5259
/// <param name="configurationBuilder">The configuration builder to add key-values to.</param>
5360
/// <param name="connectionStrings">The list of connection strings used to connect to the configuration store and its replicas.</param>
@@ -64,7 +71,30 @@ public static IConfigurationBuilder AddAzureAppConfiguration(
6471
}
6572

6673
/// <summary>
67-
/// Adds key-value data from an Azure App Configuration store to a configuration builder.
74+
/// Adds key-value data from an Azure App Configuration store to a configuration builder using endpoint with AAD authentication.
75+
/// This is a simplified overload that loads all key-values with no label. For advanced scenarios such as selecting specific keys,
76+
/// filtering by labels, configuring refresh, using feature flags, or resolving Key Vault references,
77+
/// use the overload that accepts an <see cref="Action{AzureAppConfigurationOptions}"/> parameter with options.Connect().
78+
/// </summary>
79+
/// <param name="configurationBuilder">The configuration builder to add key-values to.</param>
80+
/// <param name="endpoint">The endpoint used to connect to the configuration store.</param>
81+
/// <param name="credential">The token credential used to authenticate requests to the configuration store.</param>
82+
/// <param name="optional">Determines the behavior of the App Configuration provider when an exception occurs while loading data from server. If false, the exception is thrown. If true, the exception is suppressed and no settings are populated from Azure App Configuration.
83+
/// <exception cref="ArgumentException"/> will always be thrown when the caller gives an invalid input configuration (connection strings, endpoints, key/label filters...etc).
84+
/// </param>
85+
/// <returns>The provided configuration builder.</returns>
86+
public static IConfigurationBuilder AddAzureAppConfiguration(
87+
this IConfigurationBuilder configurationBuilder,
88+
Uri endpoint,
89+
TokenCredential credential,
90+
bool optional = false)
91+
{
92+
return configurationBuilder.AddAzureAppConfiguration(options => options.Connect(endpoint, credential), optional);
93+
}
94+
95+
/// <summary>
96+
/// Adds key-value data from an Azure App Configuration store to a configuration builder using a fully configurable <see cref="AzureAppConfigurationOptions"/> callback for advanced scenarios.
97+
/// Use this overload when you need to: select keys by prefix, filter by labels, configure dynamic refresh, use feature flags, resolve Key Vault references, etc.
6898
/// </summary>
6999
/// <param name="configurationBuilder">The configuration builder to add key-values to.</param>
70100
/// <param name="action">A callback used to configure Azure App Configuration options.</param>

0 commit comments

Comments
 (0)