microsoft / vscode-azuretools

Common packages for building Azure extensions for VS Code
MIT License
104 stars 67 forks source link

[@microsoft/vscode-azext-azureauth] Signing in to another account while already signed in to an account have unexpected results #1651

Open shsuman opened 10 months ago

shsuman commented 10 months ago

Steps to repro:

  1. Sign In with Account A using the AzureSubscriptionProvider.signIn() method
  2. You can see all the subs of A
  3. Sign in with Account B using the AzureSubscriptionProvider.signIn() method
  4. You cannot get any subscription. It returns an empty [ ]
  5. Sign in to tenant using the signInToTenant() method. You will see a list of all the tenants of B. Pick your tenant and sign in. Note that, the tenants of B do not required any MFA and when signed in as the first step it shows all the subscriptions of B without signing in to tenant specifically
  6. You can see the subs of A instead of B.

Both 5 and 6 are not ideal. The experience should be when signing in to B, you should see the subs of B as was the case with Azure Account extension.

alexweininger commented 10 months ago

@shsuman, I can't reproduce this scenario. If you could provide a video or screenshots that would be very helpful.

shsuman commented 10 months ago

https://github.com/microsoft/vscode-azuretools/assets/44413557/a6ae35fb-5b88-4ddd-b0ae-89578e182797

shsuman commented 10 months ago

@alexweininger In the video above, account A is my Personal account, shantnusuman@hotmail.com and account B is shsuman@microsoft.com.

So, I guess #6 is not an issue but #5 is still there. I have to run this additional sign in to directory to get the subs of account B.

alexweininger commented 9 months ago

I can reproduce what you're describing, except in Azure Resources we handle this by showing a "Sign in to Directory..." item in the tree. I encourage you to do the same.

image

The section of code that adds this item is here.

As for why this is happening, I'm unsure and I'll investigate further. But for now if you add the tree item I think it should be fine as this shouldn't be a super common scenario for everyday users.

shsuman commented 8 months ago

@alexweininger Any updates on this ?