[SQL Migration] Properly respect user's encryptConnection and trustServerCertificate settings (#21824)

* WIP

* Always get latest current connection

* Update more references

* Clean up

* Clean up

* vbump

* Update comments

* Address PR feedback

* Separate into helper methods
This commit is contained in:
Raymond Truong
2023-02-08 10:12:11 -08:00
committed by GitHub
parent 99a924dbcd
commit 480d8e2cd0
25 changed files with 206 additions and 154 deletions

View File

@@ -628,6 +628,7 @@ export async function getLocationDisplayName(location: string): Promise<string>
export async function validateIrSqlDatabaseMigrationSettings(
migration: MigrationStateModel,
sourceServerName: string,
encryptConnection: boolean,
trustServerCertificate: boolean,
sourceDatabaseName: string,
targetDatabaseName: string,
@@ -654,17 +655,18 @@ export async function validateIrSqlDatabaseMigrationSettings(
userName: migration._sqlServerUsername,
password: migration._sqlServerPassword,
authentication: migration._authenticationType,
encryptConnection: encryptConnection,
trustServerCertificate: trustServerCertificate,
// encryptConnection: true,
},
targetSqlConnection: {
testConnectivity: testTargetConnectivity,
dataSource: targetDatabaseServer.properties.fullyQualifiedDomainName,
userName: migration._targetUserName,
password: migration._targetPassword,
authentication: MigrationSourceAuthenticationType.Sql,
// when connecting to a target Azure SQL DB, use true/false
encryptConnection: true,
trustServerCertificate: false,
authentication: MigrationSourceAuthenticationType.Sql,
}
};
@@ -686,6 +688,7 @@ export async function validateIrSqlDatabaseMigrationSettings(
export async function validateIrDatabaseMigrationSettings(
migration: MigrationStateModel,
sourceServerName: string,
encryptConnection: boolean,
trustServerCertificate: boolean,
sourceDatabaseName: string,
networkShare: NetworkShare,
@@ -728,7 +731,7 @@ export async function validateIrDatabaseMigrationSettings(
dataSource: sourceServerName,
userName: migration._sqlServerUsername,
password: migration._sqlServerPassword,
// to-do: use correct value of encryptConnection and trustServerCertificate
encryptConnection: encryptConnection,
trustServerCertificate: trustServerCertificate,
authentication: migration._authenticationType,
}
@@ -954,8 +957,8 @@ export interface ValdiateIrDatabaseMigrationResponse {
sourceDatabaseName: string,
sourceSqlConnection: {
testConnectivity: boolean,
encryptConnection: true,
trustServerCertificate: false,
encryptConnection: boolean,
trustServerCertificate: boolean,
dataSource: string,
},
backupConfiguration: {
@@ -1042,15 +1045,6 @@ export interface CopyProgressDetail {
errors: string[];
}
export interface SqlConnectionInfo {
dataSource: string;
authentication: string;
username: string;
password: string;
encryptConnection: string;
trustServerCertificate: string;
}
export interface BackupConfiguration {
sourceLocation?: SourceLocation;
targetLocation?: TargetLocation;