microsoft / vscode-azuretools

Common packages for building Azure extensions for VS Code
MIT License
106 stars 66 forks source link

[@microsoft/vscode-azext-azureauth] Removing the trusted extension and signing in to a second account may result in empty subscriptions #1702

Open xiaolang124 opened 6 months ago

xiaolang124 commented 6 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. Click Account -> Manage trusted extensions and remove just used extension
  4. Sign In with Account B using the AzureSubscriptionProvider.signIn() method
  5. You cannot get any subscription. It returns an empty [ ]

Related code

    let disposable2 = vscode.commands.registerCommand('authtest.listSubs', async () => {

        const provider = await ext.subscriptionProviderFactory();
        if (!await provider.isSignedIn()) {
            void provider.signIn();
        }
        if (await provider.isSignedIn()) {
            vscode.window.showInformationMessage('Signed in!');
            var l = await provider.getSubscriptions(false);
            vscode.window.showInformationMessage('Got subscriptions!' + l.length);
        }
    });
bwateratmsft commented 6 months ago

Do you have any value for the VSCode setting azureResourceGroups.selectedSubscriptions?

xiaolang124 commented 6 months ago

@bwateratmsft I don't think so. I haven't edited the settings. Where can I verify this setting?

bwateratmsft commented 6 months ago

image

xiaolang124 commented 6 months ago

I don't have this setting, yet I'm still encountering this problem. image