Questions tagged [sqlpackage]

A command line utility for automating SSDT database deployment tasks.

SqlPackage.exe is a command line utility that automates the following database development tasks:

  • Extract: Creates a database snapshot (.dacpac) file from a live SQL Server or Windows Azure SQL Database.

  • Export: Exports a live database - including database schema and user data - from SQL Server or Windows Azure SQL Database to a BACPAC package (.bacpac file).

  • Import: Imports the schema and table data from a BACPAC package into a new user database in an instance of SQL Server or Windows Azure SQL Database.

  • Publish: Incrementally updates a database schema to match the schema of a source .dacpac file. If the database does not exist on the server, the publish operation will create it. Otherwise, an existing database will be updated.

  • DeployReport: Creates an XML report of the changes that would be made by a publish action.

  • DriftReport: Creates an XML report of the changes that have been made to a registered database since it was last registered.

  • Script: Creates a Transact-SQL incremental update script that updates the schema of a target to match the schema of a source.

The SqlPackage.exe command line allows you to specify these actions along with action specific parameters and properties.

196 questions
3
votes
0 answers

SSDT: incremental update script including data using sqlpackage.exe

I have an SSDT project with VS2015 and using SqlPackage.exe to generate deployment scripts and incremental update scripts. The database project contains post deployment scripts. here's how I generate the main script for DB…
3
votes
2 answers

How to use multiple SQLCMD variables with SqlPackage.exe while deploying a DacPac?

I am deploying a dacpac using sqlpackage.exe and need to pass SqlCMD variables for a postdeployment script in the dacpac. I found a related question here and here. But i am getting the following error: Missing values for the following SqlCmd…
user2082197
  • 31
  • 1
  • 2
3
votes
2 answers

Sqlproj: Which solution to deploy a database in command line?

I am currently deploying a website to a server by using the Microsoft Web Deployment technologies (msbuild and msdeploy commands). The website requires the deployment of a database and both will be in the same server. I am searching the best…
JM89
  • 149
  • 1
  • 1
  • 11
3
votes
1 answer

Overriding DefaultDataPath and DefaultLogPath variables when using SqlPackage to publishing a dacpac

The environment: Using a SQL Server Database Tool in Visual Studio 2013, Update 4 to create a DacPac for publishing a database. Using TFS build to build and drop the database project. Using SqlPackage version to publish the dacpac to SQL Server…
jlo
  • 1,121
  • 1
  • 11
  • 16
3
votes
4 answers

What is the right parameter for SqlPackage.exe to publish a .dacpac file that can drop the absent objects on target database?

As we can use SqlPackage.exe from Microsoft SSDT in Visual Studio 2012 to sync database as discussed here, I'm using it to sync target database, called TargetDb, to match with the source database objects stored in an SQL Server Database project,…
3
votes
0 answers

Best way to detect a "data loss" publish action when calling SSDT's SQLPackage.exe

When calling SQLPackage.exe (syntax described here) with publish action /a:Publish, there are cases when data loss occurs and the execution will be halted; this is specified by setting the parameter /p:BlockOnDataLoss (default to be 'true'). I need…
Nam G VU
  • 33,193
  • 69
  • 233
  • 372
2
votes
1 answer

SqlPackage.exe deploy DACPAC with always encrypted and Key vault

I am trying to deploy a DACPAC using Azure Release pipeline. Following are the methods which I used Using Azure SQL DACPAC task - While using this approach, as part of additional properties following set of params are passed for…
2
votes
0 answers

Use Microsoft.SqlServer.Dac.DacServices from Powershell Core?

I'm trying to use DacServices from a Powershell Core script. Unfortunately, it seems DacServices requires System.Diagnostics.Eventing.EventDescriptor, which isn't available in .NET 6. I'm using Powershell Core 7.2.5. Is there a convenient way around…
Brian Vallelunga
  • 9,869
  • 15
  • 60
  • 87
2
votes
2 answers

Azure Devops SQL DacpacTask failing for Azure Key Vault

I'm trying to deploy a dacpac to an Azure Sql Database with Always encrypted enabled. The Devops agent is running in a self-hosted VM with sqlpackage.exe version 19 with build 16.0.5400.1 installed on it. I've been able to trace down the issues by…
2
votes
2 answers

Migrating .sqlproj to Sdk style breaks certain database options

I'm trying to migrate my existing .sqlproj targeting .NET Framework 4.7.2 to the new Sdk style project so that I can generate the .dacpac using the new .NET SDK. My new .csproj looks like this:
UserControl
  • 14,766
  • 20
  • 100
  • 187
2
votes
1 answer

sqlpackage.exe to ignore a specific schema in DevOps Release pipeline

I want to ignore changes to a specific schema in the release pipeline in DevOps. I am trying to find the Sqlpackage.exe command for it. I checked the document here:…
2
votes
0 answers

Exporting a database to .bacpac while excluding certain tables using SqlPackage

We regularly use SqlPackage.exe to export a SQL Server (usually from Azure SQL) database for use in other contexts - local development, issue investigation, etc. This works great, but we have a few situations where the size of the exported database…
Isaac Dontje Lindell
  • 3,246
  • 6
  • 24
  • 35
2
votes
0 answers

Why sqlpackage publish action takes 30 minutes?

I'm running sqlpackage publish action for one predeploy file with one alter command against my prod sql server and it takes about 30 minutes! What is the reason for it? I see it creates complex select statement for [sys] tables. Is it mandatory or…
arielma
  • 1,308
  • 1
  • 11
  • 29
2
votes
1 answer

Sqlpackage throwing error without details

I am currently working on an application to easily restore a bacpac file. Unfortunately i have the following issue: Sqlpackage throws a error that it cannot import a database because it contains one or more user objects, but when i restore the…
2
votes
1 answer

Azure SQL Server database user login disabled after DACPAC publish

I have CICD pipeline setup for deploying the database using DACPAC. I have arguments for sqlpackge.exe here /p:ExcludeObjectTypes="Users;RoleMembership;Logins;ServerRoles;ServerRoleMembership" This works fine, the users for the database is disabled…
Benzhi Pan
  • 161
  • 1
  • 14