UserPassCredentials Class

Credentials object for Headless Authentication, i.e. AAD authentication via username and password.

Headless Auth requires an AAD login (no a Live ID) that already has permission to access the resource e.g. an organization account, and that 2-factor auth be disabled.

Optional kwargs may include:

  • cloud_environment (msrestazure.azure_cloud.Cloud): A targeted cloud environment

  • china (bool): Configure auth for China-based service, default is 'False'.

  • tenant (str): Alternative tenant, default is 'common'.

  • resource (str): Alternative authentication resource, default is 'https://management.core.windows.net/'.

  • verify (bool): Verify secure connection, default is 'True'.

  • timeout (int): Timeout of the request in seconds.

  • proxies (dict): Dictionary mapping protocol or protocol and hostname to the URL of the proxy.

  • cache (adal.TokenCache): A adal.TokenCache, see ADAL configuration

for details. This parameter is not used here and directly passed to ADAL.

Inheritance
UserPassCredentials

Constructor

UserPassCredentials(username, password, client_id=None, secret=None, **kwargs)

Parameters

username
str
Required

Account username.

password
str
Required

Account password.

client_id
str
default value: None

Client ID, if not set, Xplat Client ID will be used.

secret
str
default value: None

Client secret, only if required by server.

Methods

set_token

Get token using Username/Password credentials.

set_token

Get token using Username/Password credentials.

set_token()

Exceptions

<xref:AuthenticationError if credentials invalid>, <xref:or call fails.>