First of all, In previous version of the SDK, ADAL was not yet available and we provided a UserPassCredentials class. This is considered deprecated and should not be used anymore.
This does not support 2FA. But as per my earlier experience with this class, we either pass below combination while creating credential object
1) User name, password,
2) User Name, Password, resource
3) Client Id , secret
4) client Id , secret and resource
Resource is by default ('https://management.core.windows.net/'.)
something like this:
return UserPassCredentials(
config_data["username"],
config_data["password"],
)
UserPassCredentials(username, password, client_id=None, secret=None, **kwargs)
last param is option which can have following values
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
I am assuming , you are passing right values in the param, Also please try to pass the combination i mentioned above and see if it works.
Hope it helps.