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

common: Handle exception raised while loading profile #610

Merged
merged 1 commit into from
Jan 6, 2022
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
6 changes: 5 additions & 1 deletion plugins/module_utils/azure_rm_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,11 @@ def _get_azure_cli_credentials(self, subscription_id=None, resource=None):
if self.is_ad_resource:
resource = 'https://graph.windows.net/'
subscription_id = subscription_id or self._get_env('subscription_id')
profile = get_cli_profile()
try:
profile = get_cli_profile()
except Exception as exc:
self.fail("Failed to load CLI profile {0}.".format(str(exc)))

credentials, subscription_id, tenant = profile.get_login_credentials(
subscription_id=subscription_id, resource=resource)
cloud_environment = get_cli_active_cloud()
Expand Down