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

Use creds in module args when auth_source is auto #1010

Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion plugins/modules/azure_rm_keyvaultkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ def get_keyvault_client(self):
return KeyVaultClient(credentials)
except Exception:
self.log("Get KeyVaultClient from service principal")
elif self.module.params['auth_source'] in ['auto', 'cli']:
elif (self.module.params['auth_source'] == 'cli'
or (self.module.params['auth_source'] == 'auto'
and self.credentials['client_id'] is None
and self.credentials['secret'] is None)):
try:
profile = get_cli_profile()
credentials, subscription_id, tenant = profile.get_login_credentials(
Expand Down
5 changes: 4 additions & 1 deletion plugins/modules/azure_rm_keyvaultkey_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,10 @@ def get_keyvault_client(self):
return KeyVaultClient(credentials)
except Exception:
self.log("Get KeyVaultClient from service principal")
elif self.module.params['auth_source'] in ['auto', 'cli']:
elif (self.module.params['auth_source'] == 'cli'
or (self.module.params['auth_source'] == 'auto'
and self.credentials['client_id'] is None
and self.credentials['secret'] is None)):
try:
profile = get_cli_profile()
credentials, subscription_id, tenant = profile.get_login_credentials(
Expand Down
5 changes: 4 additions & 1 deletion plugins/modules/azure_rm_keyvaultsecret.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ def get_keyvault_client(self):
return KeyVaultClient(credentials)
except Exception:
self.log("Get KeyVaultClient from service principal")
elif self.module.params['auth_source'] in ['auto', 'cli']:
elif (self.module.params['auth_source'] == 'cli'
or (self.module.params['auth_source'] == 'auto'
and self.credentials['client_id'] is None
and self.credentials['secret'] is None)):
try:
profile = get_cli_profile()
credentials, subscription_id, tenant = profile.get_login_credentials(
Expand Down
5 changes: 4 additions & 1 deletion plugins/modules/azure_rm_keyvaultsecret_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ def get_keyvault_client(self):
return KeyVaultClient(credentials)
except Exception:
self.log("Get KeyVaultClient from service principal")
elif self.module.params['auth_source'] in ['auto', 'cli']:
elif (self.module.params['auth_source'] == 'cli'
or (self.module.params['auth_source'] == 'auto'
and self.credentials['client_id'] is None
and self.credentials['secret'] is None)):
try:
profile = get_cli_profile()
credentials, subscription_id, tenant = profile.get_login_credentials(
Expand Down