Skip to content

Conversation

@Kocheey
Copy link
Contributor

@Kocheey Kocheey commented Jul 10, 2025

Added the "KillDatabaseConnection" search string to RepairBacpac.Simple.json, to fix the issue "KILL DATABASE CONNECTION' is not supported in this version of SQL Server"

See for reference:
https://www.linkedin.com/pulse/how-fix-bacpac-import-error-kill-database-connection-supported-ahmed-0zxle/

Added the "KillDatabaseConnection" search string to RepairBacpac.Simple.json, to fix the issue "KILL DATABASE CONNECTION' is not supported in this version of SQL Server"

See for reference:
https://www.linkedin.com/pulse/how-fix-bacpac-import-error-kill-database-connection-supported-ahmed-0zxle/
@FH-Inway
Copy link
Member

Thanks for the contribution!

Could you share what the full <Element> tag looks like that should be removed? I ask because when we implemented Repair-D365BacpacModelFile, RepairBacpac.Simple.json was created to remove elements that include the KillDatabaseConnection grant. See #820 for more information on that.

Also, did you try the latest SqlPackage version for the import? Some people report that the issue is resolved by that. You can use Invoke-D365InstallSqlPackage -Latest to update it.

In general, we want to avoid having to change d365fo.tools for every change in the bacpac model.xml files that break the bacpac import. That is why Repair-D365BacpacModelFile was implemented in such a way that one can provide their own .json files with the information what elements to remove.

In this case, I've seen the KillDatabaseConnection issue come up repeatedly although people have been using Repair-D365BacpacModelFile (e.g. here: https://www.yammer.com/dynamicsaxfeedbackprograms/threads/3244981114773504). So it may be worth changing the default RepairBacpac.Simple.json file just so that people do not have to bother with their own .json files.

@Splaxi fyi

@Kocheey
Copy link
Contributor Author

Kocheey commented Jul 11, 2025

Hi Florian,

this is the full element which caused the issue.

<Element Type="SqlPermissionStatement" Name="[Grant.KillDatabaseConnection.Database].[ms_uno_dev_writer].dbo]">
	<Property Name="Permission" Value="1114" />
	<Relationship Name="Grantee">
		<Entry>
			<References Name="[ms_uno_dev_writer]" />
		</Entry>
	</Relationship>
	<Relationship Name="SecuredObject">
		<Entry>
			<References Disambiguator="1" />
		</Entry>
	</Relationship>
</Element>

Thanks for the hint with the latest SqlPackage. This solved the issue, and I was able to import the backup without modifing the model.xml

@Splaxi
Copy link
Collaborator

Splaxi commented Jul 11, 2025

Knowing that "KillDatabaseConnection" has been an issue multiple times - I'm in favor of taking it into the module, on the next release.

@FH-Inway
Copy link
Member

FH-Inway commented Jul 17, 2025

Also got the issue today. I think the best way forward is to have Invoke-D365InstallSqlPackage by default install the latest version of SqlPackage, i.e. make the behavior of the -Latest switch the default behavior.

I think the times when bacpac conversion required a specific older version of SqlPackage are far enough in the past. The last issues in that area were more often caused by an outdated version of SqlPackage.

@Splaxi Splaxi merged commit cbe9541 into d365collaborative:master Jul 18, 2025
5 checks passed
@Splaxi
Copy link
Collaborator

Splaxi commented Jul 18, 2025

@FH-Inway

I'm in favor of making things as seamless and struggle free as possible. How do we plan around the non-breaking changes, and honor that we want the latest to be default?

Update the cmdlet to handle Latest:$true ?

@FH-Inway
Copy link
Member

My plan was replace the link in the following line with https://aka.ms/sqlpackage-windows

[string] $Url = "https://go.microsoft.com/fwlink/?linkid=2261576"

I would leave the -Latest switch to not break people that have pipelines set up that use it.
But I would change the following logic to instead output an information that this switch is no longer necessary because the latest version is now the default.

if ($Latest) {
$Url = "https://aka.ms/sqlpackage-windows"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants