Skip to content

Commit 9c50829

Browse files
committed
login-subscriptions
1 parent e63b732 commit 9c50829

File tree

1 file changed

+7
-6
lines changed
  • src/azure-cli/azure/cli/command_modules/profile

1 file changed

+7
-6
lines changed

src/azure-cli/azure/cli/command_modules/profile/custom.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,13 @@ def login(cmd, username=None, password=None, tenant=None, scopes=None, allow_no_
205205

206206
# Launch interactive account selection. No JSON output.
207207
if select_subscription:
208-
from ._subscription_selector import SubscriptionSelector
209-
from azure.cli.core._profile import _SUBSCRIPTION_ID
210-
211-
selected = SubscriptionSelector(subscriptions)()
212-
profile.set_active_subscription(selected[_SUBSCRIPTION_ID])
213-
208+
if subscriptions:
209+
from ._subscription_selector import SubscriptionSelector
210+
from azure.cli.core._profile import _SUBSCRIPTION_ID
211+
selected = SubscriptionSelector(subscriptions)()
212+
profile.set_active_subscription(selected[_SUBSCRIPTION_ID])
213+
else:
214+
print("\nNo accessible tenant. Make sure your account has access to at least one tenant.\n")
214215
print(LOGIN_ANNOUNCEMENT)
215216
logger.warning(LOGIN_OUTPUT_WARNING)
216217
return

0 commit comments

Comments
 (0)