diff --git a/src/sql/workbench/services/connection/browser/connectionWidget.ts b/src/sql/workbench/services/connection/browser/connectionWidget.ts index f96908a5e4..eb5dcc48a7 100644 --- a/src/sql/workbench/services/connection/browser/connectionWidget.ts +++ b/src/sql/workbench/services/connection/browser/connectionWidget.ts @@ -939,7 +939,11 @@ export class ConnectionWidget extends lifecycle.Disposable { // If account was not filled in from received configuration, select the first account. this._azureAccountDropdown.select(0); account = this._azureAccountList[0]; - accountName = account.key.accountId; + if (this._azureAccountList.length > 0) { + accountName = account.key.accountId; + } else { + this._logService.debug('fillInConnectionInputs: No accounts available'); + } } await this.onAzureAccountSelected(); @@ -959,7 +963,7 @@ export class ConnectionWidget extends lifecycle.Disposable { this._azureTenantId = account.properties.tenants[0].id; this.onAzureTenantSelected(0); } - else { + else if (accountName) { this._logService.error(`fillInConnectionInputs : Could not find any tenants for account ${accountName}`); } }).catch(err => this._logService.error(`Unexpected error populating initial Azure Account options : ${err}`));