-
Notifications
You must be signed in to change notification settings - Fork 3.4k
{Profile} Fix #31992: az login: Do not launch SubscriptionSelector when there is no accessible tenant
#31997
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -205,12 +205,17 @@ def login(cmd, username=None, password=None, tenant=None, scopes=None, allow_no_ | |||||
|
|
||||||
| # Launch interactive account selection. No JSON output. | ||||||
| if select_subscription: | ||||||
| from ._subscription_selector import SubscriptionSelector | ||||||
| from azure.cli.core._profile import _SUBSCRIPTION_ID | ||||||
|
|
||||||
| selected = SubscriptionSelector(subscriptions)() | ||||||
| profile.set_active_subscription(selected[_SUBSCRIPTION_ID]) | ||||||
|
|
||||||
| if subscriptions: | ||||||
| from ._subscription_selector import SubscriptionSelector | ||||||
| from azure.cli.core._profile import _SUBSCRIPTION_ID | ||||||
| selected = SubscriptionSelector(subscriptions)() | ||||||
| profile.set_active_subscription(selected[_SUBSCRIPTION_ID]) | ||||||
| else: | ||||||
| # By default, if the account has no access to any subscription, CLI will fail earlier in _profile.py. | ||||||
| # When --allow-no-subscriptions is specified, and the account | ||||||
| # - has access to tenant, but no subscription, `subscriptions` will be the tenant account | ||||||
| # - has access to no tenant, `subscriptions` will be []. This line will be hit. | ||||||
| print("\nNo accessible tenant. Make sure your account has access to at least one tenant.\n") | ||||||
|
||||||
| print("\nNo accessible tenant. Make sure your account has access to at least one tenant.\n") | |
| logger.warning("\nNo accessible tenant. Make sure your account has access to at least one tenant.\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#3150 made
az loginnot fail when--allow-no-subscriptionsis provided and the user account has no accessible tenant.