DACPAC Instructions
- Download and install the latest SQLPackage from https://aka.ms/dacfx-msi
- Ensure you have a current back-up of the target database(s)
- Save the following as a .bat file:
- Replace SQLSERVER with the SQL Server name/instance
- Replace DATABASE with the target database name
- If using SQL authentication, replace LOGIN and PASSWORD with appropriate credentials
- Copy the batch file into the data model folder, then execute
Option 1: Use Integrated (Windows) Security
*Note that the command below uses Integrated (Windows) Authentication, so the account running it needs to be a SQL Admin*
"C:\Program Files\Microsoft SQL Server\170\DAC\bin\sqlpackage.exe" /action:Publish /Properties:ScriptDatabaseOptions=False /Properties:BlockOnPossibleDataLoss=False /p:IgnorePermissions=true /p:IgnoreUserSettingsObjects=true /p:GenerateSmartDefaults=true /p:ExcludeObjectTypes=Users;ServerRoleMembership;ServerRoles;DatabaseRoles /SourceFile:"database.dacpac" /TargetConnectionString:"Data Source=SQLSERVER;Initial Catalog=DATABASE;TrustServerCertificate=True;Integrated Security=True;" /Variables:Release=11.3.143
pause
Option 2: Use SQL Authentication
"C:\Program Files\Microsoft SQL Server\170\DAC\bin\sqlpackage.exe" /action:Publish /Properties:ScriptDatabaseOptions=False /Properties:BlockOnPossibleDataLoss=False /p:IgnorePermissions=true /p:IgnoreUserSettingsObjects=true /p:GenerateSmartDefaults=true /p:ExcludeObjectTypes=Users;ServerRoleMembership;ServerRoles;DatabaseRoles /SourceFile:"database.dacpac" /TargetConnectionString:"Data Source=SQLSERVER;Initial Catalog=DATABASE;TrustServerCertificate=True;User Id=LOGIN;Password=PASSWORD" /Variables:Release=11.3.143
pause