Hello,
Seem we are quite update today. haha.
I had the same issue as you these 2 days. I think the issue caused by MS updated their Azure SQL export script in LCS but made something wrong.
Anyway, there are some hints helping us to resolve the issue.
1. Rename you .bacpac file to .zip
2. open the zip file and find the model.xml file inside, copy it out to somewhere you like
3. Open the model.xml file, which is pretty big.
4. Find string "Grant.KillDatabaseConnection" and replace it as "Grant.Alter.Database" in the model.xml
If you comparing with an old .bacpac, you will find this is the corrent string in model.xml of old bacpac file.
KillDatabaseConnection is SQL 2008 script and not sure why it generated to our current SQL 2019 version backup export.
5. Put the new model.xml file back to the .zip file
- copy the following into it.
$modelXmlPath = Read-Host "model.xml file path"
$hasher = [System.Security.Cryptography.HashAlgorithm]::Create("System.Security.Cryptography.SHA256CryptoServiceProvider")
$fileStream = new-object System.IO.FileStream ` -ArgumentList @($modelXmlPath, [System.IO.FileMode]::Open)
$hash = $hasher.ComputeHash($fileStream)
$hashString = ""
Foreach ($b in $hash) { $hashString += $b.ToString("X2") }
$fileStream.Close()
$hashString
​​​​​​​
- run the checksum.ps1 and enter your model file path.
7. Rename it back to .bacpac.
8. Run the data package loading again, for an example I used:
"C:\Program Files\Microsoft SQL Server\160\DAC\bin\SqlPackage.exe" /a:import /sf:C:\Temp\xxx-bldbackup.bacpac /tsn:localhost /tdn:AxDB_BLD /p:CommandTimeout=1200 /TargetTrustServerCertificate:True
Hope this help you and me.