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

Treeview can get stuck displaying 'select tenant...' when there's only one tenant to choose from #680

Closed
peterbom opened this issue May 20, 2024 · 1 comment
Assignees

Comments

@peterbom
Copy link
Contributor

Describe the bug

The Cloud Explorer treeview can end up displaying the 'select tenant' node (shown below), and when you select it you get a message saying you only have one tenant to choose from.
image
image

The workaround is for the user to sign out and sign in again, but it is not at all obvious they need to do that.

To Reproduce

The circumstances under which this happens are:

  • The user was previously signed in to the AKS extension, but hasn't used it for some time.
  • The user's account is associated with exactly one Microsoft tenant.
  • The user's session is valid for listing tenants, but cannot be silently exchanged for a token for the tenant.

At this stage I'm unsure how to reproduce the last condition or the length of inactivity required to observe this, since token exchange is handled at a lower layer.

Expected behavior

If there is only one tenant to choose from, the treeview should automatically invoke any extra interaction required for the user to complete the authentication process.

Additionally, the 'select tenant' command should be made more robust. Rather than displaying an information message saying there's only one tenant, it could also invoke getAuthSession to ensure the user has a valid token for the tenant.

Additional context

To protect against this kind of bug in the future it would be worth defining more tightly what it means for a session to be "ready" and enforcing that in the API contract.

The current design is too ambiguous. By convention we avoid setting the selectedTenant property of the session if it's not possible to silently obtain a token for that tenant, but that is not enforced by the contract (consumers can set the selectedTenant to a value which violates that convention). I'll create a separate issue for some clean-up work.

@peterbom
Copy link
Contributor Author

peterbom commented Jun 4, 2024

Fixed by #681

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant