diff --git a/extensions/dacpac/src/wizard/dataTierApplicationWizard.ts b/extensions/dacpac/src/wizard/dataTierApplicationWizard.ts index 39a5d175fc..94bae415f1 100644 --- a/extensions/dacpac/src/wizard/dataTierApplicationWizard.ts +++ b/extensions/dacpac/src/wizard/dataTierApplicationWizard.ts @@ -101,7 +101,16 @@ export class DataTierApplicationWizard { this.model.database = profile.databaseName; } - this.connection = await azdata.connection.getCurrentConnection(); + // get the connection of the node the wizard was launched from + if (profile?.id) { + this.connection = await azdata.connection.getConnection(await azdata.connection.getUriForConnection((profile.id))); + } + + // if no profile was passed in if launched from command palette, try using the current active connection + if (!this.connection) { + this.connection = await azdata.connection.getCurrentConnection(); + } + if (!this.connection || (profile && this.connection.connectionId !== profile.id)) { // check if there are any active connections const connections = await azdata.connection.getConnections(true);