whenever i try to import BACPAC on local sql server I am getting below error message:
TITLE: Microsoft SQL Server Management Studio
------------------------------
Could not import package.
Warning SQL0: The source contains users that rely on an external authentication provider that is not supported by the target. These users will be treated as users without logins.
Warning SQL72012: The object [DB_NAME_Data] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
Warning SQL72012: The object [DB_NAME_Log] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box.
Error SQL72014: .Net SqlClient Data Provider: Msg 33161, Level 15, State 1, Line 1 Database master keys without password are not supported in this version of SQL Server.
Error SQL72045: Script execution error. The executed script:
CREATE MASTER KEY;
(Microsoft.SqlServer.Dac)
------------------------------
BUTTONS:
OK
------------------------------
All the previously reported issues on SO are not same as this one. Does anyone faced the same issue before?
To import from a BACPAC file into a new single database using the Azure portal, open the appropriate server page and then, on the toolbar, select Import database. Select the storage account and the container for the BACPAC file and then select the BACPAC file from which to import.
bacpac file. To do this in Azure Data Studio, right-click on your connection and select the Data-tier application wizard option and then select the Export the schema and data from a database to the logical . bacpac file format option. The wizard will detect the connection server name and the source database.
Steps to Import/Restore BACPAC file. Open SQL Server management studio, connect to SQL instances where you want to restore database and right click on Database. Then you will get option as shown in below picture. Click on Import Data-tier Application.
Try running this against your master
database (right click on the server name in SSMS -> New Query)
sp_configure 'contained database authentication', 1;
GO
RECONFIGURE;
GO
After this, you can go through the import bacpac wizard again and the issue should be resolved.
Eventually I was able to resolve this issue by following option 2 suggested here
In nutshell,
.\RemoveMasterKey.ps1 -bacpacPath "C:\BacPacs\fileName.bacpac"
Once above command finishes we get the -patched bacpac which imported seamlessly.
With new MS SQL Server 2016 (13.0.1745.2) and SSMS v17.6 this is not an issue anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With