Compartir a través de


ICredentialsLoader.LoadFirstValidCredentialsAsync Method

Definition

Load the first valid credential from the credentials description list. This is useful when you have multiple deployments (for instance on your developer machine, you can use a certificate from KeyVault, and when deployed in AKS, you use workload identity federation for AKS. You can express the list of credentials in the appsettings.json file, and this method will load the most appropriate based on the order.

public System.Threading.Tasks.Task<Microsoft.Identity.Abstractions.CredentialDescription?> LoadFirstValidCredentialsAsync (System.Collections.Generic.IEnumerable<Microsoft.Identity.Abstractions.CredentialDescription> credentialDescriptions, Microsoft.Identity.Abstractions.CredentialSourceLoaderParameters? parameters = default);
abstract member LoadFirstValidCredentialsAsync : seq<Microsoft.Identity.Abstractions.CredentialDescription> * Microsoft.Identity.Abstractions.CredentialSourceLoaderParameters -> System.Threading.Tasks.Task<Microsoft.Identity.Abstractions.CredentialDescription>
Public Function LoadFirstValidCredentialsAsync (credentialDescriptions As IEnumerable(Of CredentialDescription), Optional parameters As CredentialSourceLoaderParameters = Nothing) As Task(Of CredentialDescription)

Parameters

credentialDescriptions
IEnumerable<CredentialDescription>

Description of the credentials.

parameters
CredentialSourceLoaderParameters

Parameters, related to the host application, that the credential source loader can use.

Returns

First valid credential description that could be loaded from the credential description list. null if none is valid. Otherwise the first CredentialDescription that could be loaded.

Applies to