in src/SqlConnectionConfig.ts [127:168]
private _validateconfig(): void {
if (!this.Server) {
throw new Error(`Invalid connection string. Please ensure 'Server' or 'Data Source' is provided in the connection string.`);
}
if (!this.Database) {
throw new Error(`Invalid connection string. Please ensure 'Database' or 'Initial Catalog' is provided in the connection string.`);
}
switch (this.FormattedAuthentication) {
case undefined:
case 'sqlpassword': {
// SQL password
if (!this.UserId) {
throw new Error(`Invalid connection string. Please ensure 'User' or 'User ID' is provided in the connection string.`);
}
if (!this.Password) {
throw new Error(`Invalid connection string. Please ensure 'Password' is provided in the connection string.`);
}
break;
}
case 'activedirectorypassword': {
if (!this.UserId) {
throw new Error(`Invalid connection string. Please ensure 'User' or 'User ID' is provided in the connection string.`);
}
if (!this.Password) {
throw new Error(`Invalid connection string. Please ensure 'Password' is provided in the connection string.`);
}
break;
}
case 'activedirectoryserviceprincipal': {
// User ID is client ID and password is secret
if (!this.UserId) {
throw new Error(`Invalid connection string. Please ensure client ID is provided in the 'User' or 'User ID' field of the connection string.`);
}
if (!this.Password) {
throw new Error(`Invalid connection string. Please ensure client secret is provided in the 'Password' field of the connection string.`);
}
break;
}
}
}