Adding support for AAD connections in import wizard (#16759)

* Adding support for aad connections in import extension

* Adding support for AAD by passing azure account token

* Adding a test for aad connections and fixing broken tests

* removing extra await
This commit is contained in:
Aasim Khan
2021-08-16 11:57:35 -07:00
committed by GitHub
parent 1121429f5c
commit f5f52b19c7
6 changed files with 144 additions and 7 deletions

View File

@@ -129,13 +129,23 @@ export class SummaryPage extends ImportPage {
let result: InsertDataResponse;
let err;
let includePasswordInConnectionString = (this.model.server.options.authenticationType === 'Integrated') ? false : true;
const currentServer = this.model.server;
const includePasswordInConnectionString = (currentServer.options.authenticationType === 'Integrated') ? false : true;
const connectionString = await azdata.connection.getConnectionString(currentServer.connectionId, includePasswordInConnectionString);
let accessToken = undefined;
if (currentServer.options.authenticationType = 'AzureMFA') {
const azureAccount = (await azdata.accounts.getAllAccounts()).filter(v => v.key.accountId === currentServer.options.azureAccount)[0];
accessToken = (await azdata.accounts.getAccountSecurityToken(azureAccount, currentServer.options.azureTenantId, azdata.AzureResource.Sql)).token;
}
try {
result = await this.provider.sendInsertDataRequest({
connectionString: await azdata.connection.getConnectionString(this.model.server.connectionId, includePasswordInConnectionString),
connectionString: connectionString,
//TODO check what SSMS uses as batch size
batchSize: 500
batchSize: 500,
azureAccessToken: accessToken
});
} catch (e) {
err = e.toString();