Azure.Identity.UsernamePasswordCredential
Enables authentication to Microsoft Entra ID using a user's username and password. If the user has MFA enabled this
credential will fail to get a token throwing an AuthenticationFailedException. Also, this credential requires a high degree of
trust and is not recommended outside of prototyping when more secure credentials can be used.
namespace Azure.Identity
{
public class UsernamePasswordCredential
{
protected UsernamePasswordCredential();
public UsernamePasswordCredential(string username, string password, string tenantId, string clientId);
public UsernamePasswordCredential(string username, string password, string tenantId, string clientId, TokenCredentialOptions options);
public UsernamePasswordCredential(string username, string password, string tenantId, string clientId, UsernamePasswordCredentialOptions options);
public virtual AuthenticationRecord Authenticate(CancellationToken cancellationToken = default(CancellationToken));
public virtual Task<AuthenticationRecord> AuthenticateAsync(CancellationToken cancellationToken = default(CancellationToken));
public virtual AuthenticationRecord Authenticate(TokenRequestContext requestContext, CancellationToken cancellationToken = default(CancellationToken));
public virtual Task<AuthenticationRecord> AuthenticateAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default(CancellationToken));
}
}