From 146d64435af885b06498df2c3365a72598927e55 Mon Sep 17 00:00:00 2001 From: Kim Santiago <31145923+kisantia@users.noreply.github.com> Date: Mon, 12 Dec 2022 10:14:08 -0800 Subject: [PATCH] fix dacpac wizard not using correct connection (#21387) --- .../dacpac/src/wizard/dataTierApplicationWizard.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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);