Skip to content

az login --allow-no-subscriptions crashes in tenant selector: 'NoneType' object has no attribute 'get' (personal MSA, no subscriptions) #34252

Open

Description

Describe the bug

az login --allow-no-subscriptions crashes in the interactive tenant/subscription selector for a personal Microsoft account (Gmail-based MSA) that has no Azure subscriptions. Plain az login reports No subscriptions found for <account>. and exits.

The traceback matches #31992 (closed), so this may be a regression or an unhandled case.

Related command

az login --allow-no-subscriptions

Errors

Retrieving tenants and subscriptions for the selection...

[Tenant and subscription selection]

The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "...\knack/cli.py", line 233, in invoke
  File "...\azure/cli/core/commands/__init__.py", line 677, in execute
  File "...\azure/cli/core/commands/__init__.py", line 820, in _run_jobs_serially
  File "...\azure/cli/core/commands/__init__.py", line 789, in _run_job
  File "...\azure/cli/core/commands/__init__.py", line 335, in __call__
  File "...\azure/cli/core/commands/command_operation.py", line 120, in handler
  File "...\azure/cli/command_modules/profile/custom.py", line 238, in login
  File "...\azure/cli/command_modules/profile/custom.py", line 128, in _select_and_set_active
  File "...\azure/cli/command_modules/profile/_subscription_selector.py", line 69, in __call__
  File "...\azure/cli/command_modules/profile/_subscription_selector.py", line 98, in _get_tenant_string
AttributeError: 'NoneType' object has no attribute 'get'

Steps to reproduce

  1. Use a personal Microsoft account with no Azure subscriptions.
  2. Run az login and pick the account. Result: No subscriptions found for <account>.
  3. Run az login --allow-no-subscriptions and pick the same account. Result: the crash above.

Expected behavior

Login succeeds with a tenant-level account, or the CLI prints a clear message (for example that the account has no accessible tenant) instead of an unhandled exception. _get_tenant_string should handle a tenant entry with missing info.

Environment

  • azure-cli 2.91.0 (azure-cli-core 2.91.0, telemetry 1.1.0), no extensions
  • Windows, Windows PowerShell 5.1

Additional context

Use case: publishing a VS Code extension with vsce publish --azure-credential now that Azure DevOps PATs are being retired.

Activity

  1. yonzhan commented on Oct 20, 2026

    @yonzhan
    Collaborator

    Thank you for opening this issue, we will look into it.

  2. added
    customer-reportedIssues that are reported by GitHub users external to the Azure organization.
    Accountaz login/account
    Azure CLI TeamThe command of the issue is owned by Azure CLI team
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    on Oct 20, 2026
  3. added this to the Backlog milestone on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Accountaz login/accountAuto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamact-identity-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions