diff --git a/auth/src/VSCodeAzureSubscriptionProvider.ts b/auth/src/VSCodeAzureSubscriptionProvider.ts index f09ce8b7e0..77249a1041 100644 --- a/auth/src/VSCodeAzureSubscriptionProvider.ts +++ b/auth/src/VSCodeAzureSubscriptionProvider.ts @@ -64,10 +64,14 @@ export class VSCodeAzureSubscriptionProvider extends vscode.Disposable implement const results: TenantIdDescription[] = []; for await (account of account ? [account] : await vscode.authentication.getAccounts(getConfiguredAuthProviderId())) { - const { client } = await this.getSubscriptionClient(account, undefined, undefined); + // Added check. Without this the getSubscriptionClient function throws the NotSignedInError + if (await this.isSignedIn(undefined, account)) { - for await (const tenant of client.tenants.list()) { - results.push(tenant); + const { client } = await this.getSubscriptionClient(account, undefined, undefined); + + for await (const tenant of client.tenants.list()) { + results.push(tenant); + } } }