Skip to content

Commit

Permalink
auth: Add check in getTenants (#1822)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexweininger authored Nov 19, 2024
1 parent 0ecfad7 commit e43f88f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions auth/src/VSCodeAzureSubscriptionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit e43f88f

Please sign in to comment.