in src/login/AzureLoginHelper.ts [165:191]
await callWithTelemetryAndErrorHandling('azure-account.initialize', async (context: IActionContext) => {
let environmentName: string = 'uninitialized';
const codePath: CodePath = 'tryExisting';
try {
await this.loadSubscriptionTenantCache();
const environment: Environment = await getSelectedEnvironment();
environmentName = environment.name;
const tenantId: string = getSettingValue(tenantSetting) || commonTenantId;
await waitUntilOnline(environment, 5000);
this.beginLoggingIn();
const loginResult = await this.authProvider.loginSilent(environment, tenantId, migrateToken);
await this.updateSessions(this.authProvider, environment, loginResult);
void this.sendLoginTelemetry(context, { trigger, codePath, environmentName, outcome: 'success' }, true);
} catch (err) {
await this.clearSessions(); // clear out cached data
if (err instanceof AzureLoginError && err.reason) {
void this.sendLoginTelemetry(context, { trigger, codePath, environmentName, outcome: 'error', message: getErrorMessage(err.reason) || getErrorMessage(err) });
} else {
void this.sendLoginTelemetry(context, { trigger, codePath, environmentName, outcome: 'failure', message: getErrorMessage(err) });
}
if (doLogin) {
await this.login(trigger);
}
} finally {
this.updateLoginStatus();
}
});