Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add authority to create track2 credentials #1299

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions plugins/module_utils/azure_rm_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,8 @@ def __init__(self, auth_source=None, profile=None, subscription_id=None, client_
verify=self._cert_validation_mode == 'validate')
self.azure_credential_track2 = client_secret.ClientSecretCredential(client_id=self.credentials['client_id'],
client_secret=self.credentials['secret'],
tenant_id=self.credentials['tenant'])
tenant_id=self.credentials['tenant'],
authority=self._adfs_authority_url)

elif self.credentials.get('client_id') is not None and \
self.credentials.get('tenant') is not None and \
Expand All @@ -1543,7 +1544,8 @@ def __init__(self, auth_source=None, profile=None, subscription_id=None, client_

self.azure_credential_track2 = certificate.CertificateCredential(tenant_id=self.credentials['tenant'],
client_id=self.credentials['client_id'],
certificate_path=self.credentials['x509_certificate_path'])
certificate_path=self.credentials['x509_certificate_path'],
authority=self._adfs_authority_url)

elif self.credentials.get('ad_user') is not None and \
self.credentials.get('password') is not None and \
Expand All @@ -1559,7 +1561,8 @@ def __init__(self, auth_source=None, profile=None, subscription_id=None, client_
self.azure_credential_track2 = user_password.UsernamePasswordCredential(username=self.credentials['ad_user'],
password=self.credentials['password'],
tenant_id=self.credentials.get('tenant'),
client_id=self.credentials.get('client_id'))
client_id=self.credentials.get('client_id'),
authority=self._adfs_authority_url)

elif self.credentials.get('ad_user') is not None and self.credentials.get('password') is not None:
tenant = self.credentials.get('tenant')
Expand All @@ -1577,7 +1580,8 @@ def __init__(self, auth_source=None, profile=None, subscription_id=None, client_
self.azure_credential_track2 = user_password.UsernamePasswordCredential(username=self.credentials['ad_user'],
password=self.credentials['password'],
tenant_id=self.credentials.get('tenant', 'organizations'),
client_id=client_id)
client_id=client_id,
authority=self._adfs_authority_url)

else:
self.fail("Failed to authenticate with provided credentials. Some attributes were missing. "
Expand Down