From 2e343a7a034178c8194d9b8f07508e76ec874287 Mon Sep 17 00:00:00 2001 From: alexweininger Date: Tue, 19 Nov 2024 15:01:54 -0800 Subject: [PATCH] auth: Add check in `getTenants` --- auth/src/VSCodeAzureSubscriptionProvider.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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); + } } }