Fix ADAL to MSAL transition of connections and account list (#21425)

This commit is contained in:
Cheena Malhotra
2022-12-15 16:38:45 -08:00
committed by GitHub
parent a5e2e77042
commit 112de46723
4 changed files with 72 additions and 46 deletions

View File

@@ -899,7 +899,9 @@ export class ConnectionManagementService extends Disposable implements IConnecti
const azureAccounts = accounts.filter(a => a.key.providerId.startsWith('azure'));
if (azureAccounts && azureAccounts.length > 0) {
let accountId = (connection.authenticationType === Constants.AuthenticationType.AzureMFA || connection.authenticationType === Constants.AuthenticationType.AzureMFAAndUser) ? connection.azureAccount : connection.userName;
let account = azureAccounts.find(account => account.key.accountId === accountId);
// For backwards compatibility with ADAL, we need to check if the account ID matches with tenant Id or just the account ID
// The OR case can be removed once we no longer support ADAL
let account = azureAccounts.find(account => account.key.accountId === accountId || account.key.accountId.split('.')[0] === accountId);
if (account) {
this._logService.debug(`Getting security token for Azure account ${account.key.accountId}`);
if (account.isStale) {