Consolidate getSubscriptions (#16821)

* Consolidate getSubscriptions

* Undo test change
This commit is contained in:
Charles Gagnon
2021-08-18 12:56:45 -07:00
committed by GitHub
parent 8c858f9990
commit df49d67f7d
9 changed files with 39 additions and 58 deletions

View File

@@ -276,11 +276,7 @@ export async function getSubscriptions(appContext: AppContext, account?: azdata.
const subscriptionService = appContext.getService<IAzureResourceSubscriptionService>(AzureResourceServiceNames.subscriptionService);
await Promise.all(account.properties.tenants.map(async (tenant: { id: string; }) => {
try {
const response = await azdata.accounts.getAccountSecurityToken(account, tenant.id, azdata.AzureResource.ResourceManagement);
const token = response.token;
const tokenType = response.tokenType;
result.subscriptions.push(...await subscriptionService.getSubscriptions(account, new TokenCredentials(token, tokenType), tenant.id));
result.subscriptions.push(...await subscriptionService.getSubscriptions(account, [tenant.id]));
} catch (err) {
const error = new Error(localize('azure.accounts.getSubscriptions.queryError', "Error fetching subscriptions for account {0} tenant {1} : {2}",
account.displayInfo.displayName,