ConfigurationExtensions.GetCredentialSettings Method

Definition

Overloads

Name Description
GetCredentialSettings(IConfiguration, String)

Returns a CredentialSettings bound from the named credential section. The supplied sectionName is treated as the credential section itself (not a parent client section). The returned settings expose the inline Key (for ApiKey sections) and the resolver-supplied TokenProvider (for token sections, when a resolver matches), so standalone callers can dispatch on either without binding a ClientSettings. Returns null only when the named section does not exist; when the section exists but no resolver claims it, returns a populated CredentialSettings with TokenProvider set to null. Never throws.

GetCredentialSettings(IConfiguration, String, CredentialResolver[])

Walks the supplied CredentialResolver chain in order (first match wins) against the named credential section and returns a CredentialSettings populated with both the bound metadata (Key, CredentialSource, AdditionalProperties) and the resolver-supplied TokenProvider. The supplied sectionName is treated as the credential section itself. Returns null only when the named section does not exist; when the section exists but no resolver claims it, returns settings with TokenProvider set to null. Never throws.

GetCredentialSettings(IConfiguration, String, IEnumerable<CredentialResolver>, Action<IConfigurationSection>)

Applies configureOverrides to a writable overlay of the named credential section, then walks the supplied CredentialResolver chain to populate TokenProvider. Unlike GetClientSettings<T>(IConfiguration, String, IEnumerable<CredentialResolver>, Action<IConfigurationSection>) — which binds the surrounding ClientSettings from the original (non-overlaid) configuration and only feeds the overlay to the resolver chain — the returned CredentialSettings here reflects the post-overlay merged view for Key, CredentialSource, AdditionalProperties, and the Item[String] indexer. The supplied sectionName is treated as the credential section itself. Returns null only when the original section does not exist; overrides cannot synthesize a credential into a missing section. Never throws.

GetCredentialSettings(IConfiguration, String)

Source:
ConfigurationExtensions.cs

Returns a CredentialSettings bound from the named credential section. The supplied sectionName is treated as the credential section itself (not a parent client section). The returned settings expose the inline Key (for ApiKey sections) and the resolver-supplied TokenProvider (for token sections, when a resolver matches), so standalone callers can dispatch on either without binding a ClientSettings. Returns null only when the named section does not exist; when the section exists but no resolver claims it, returns a populated CredentialSettings with TokenProvider set to null. Never throws.

public static System.ClientModel.Primitives.CredentialSettings? GetCredentialSettings(this Microsoft.Extensions.Configuration.IConfiguration configuration, string sectionName);
static member GetCredentialSettings : Microsoft.Extensions.Configuration.IConfiguration * string -> System.ClientModel.Primitives.CredentialSettings
<Extension()>
Public Function GetCredentialSettings (configuration As IConfiguration, sectionName As String) As CredentialSettings

Parameters

configuration
IConfiguration
sectionName
String

Returns

Applies to

GetCredentialSettings(IConfiguration, String, CredentialResolver[])

Source:
ConfigurationExtensions.cs

Walks the supplied CredentialResolver chain in order (first match wins) against the named credential section and returns a CredentialSettings populated with both the bound metadata (Key, CredentialSource, AdditionalProperties) and the resolver-supplied TokenProvider. The supplied sectionName is treated as the credential section itself. Returns null only when the named section does not exist; when the section exists but no resolver claims it, returns settings with TokenProvider set to null. Never throws.

public static System.ClientModel.Primitives.CredentialSettings? GetCredentialSettings(this Microsoft.Extensions.Configuration.IConfiguration configuration, string sectionName, params System.ClientModel.Primitives.CredentialResolver[] resolvers);
static member GetCredentialSettings : Microsoft.Extensions.Configuration.IConfiguration * string * System.ClientModel.Primitives.CredentialResolver[] -> System.ClientModel.Primitives.CredentialSettings
<Extension()>
Public Function GetCredentialSettings (configuration As IConfiguration, sectionName As String, ParamArray resolvers As CredentialResolver()) As CredentialSettings

Parameters

configuration
IConfiguration
sectionName
String
resolvers
CredentialResolver[]

Returns

Applies to

GetCredentialSettings(IConfiguration, String, IEnumerable<CredentialResolver>, Action<IConfigurationSection>)

Source:
ConfigurationExtensions.cs

Applies configureOverrides to a writable overlay of the named credential section, then walks the supplied CredentialResolver chain to populate TokenProvider. Unlike GetClientSettings<T>(IConfiguration, String, IEnumerable<CredentialResolver>, Action<IConfigurationSection>) — which binds the surrounding ClientSettings from the original (non-overlaid) configuration and only feeds the overlay to the resolver chain — the returned CredentialSettings here reflects the post-overlay merged view for Key, CredentialSource, AdditionalProperties, and the Item[String] indexer. The supplied sectionName is treated as the credential section itself. Returns null only when the original section does not exist; overrides cannot synthesize a credential into a missing section. Never throws.

public static System.ClientModel.Primitives.CredentialSettings? GetCredentialSettings(this Microsoft.Extensions.Configuration.IConfiguration configuration, string sectionName, System.Collections.Generic.IEnumerable<System.ClientModel.Primitives.CredentialResolver> resolvers, Action<Microsoft.Extensions.Configuration.IConfigurationSection> configureOverrides);
static member GetCredentialSettings : Microsoft.Extensions.Configuration.IConfiguration * string * seq<System.ClientModel.Primitives.CredentialResolver> * Action<Microsoft.Extensions.Configuration.IConfigurationSection> -> System.ClientModel.Primitives.CredentialSettings
<Extension()>
Public Function GetCredentialSettings (configuration As IConfiguration, sectionName As String, resolvers As IEnumerable(Of CredentialResolver), configureOverrides As Action(Of IConfigurationSection)) As CredentialSettings

Parameters

configuration
IConfiguration
sectionName
String
configureOverrides
Action<IConfigurationSection>

Returns

Applies to