A DACPAC (Data-tier Application Package) is a package containing a database schema, including objects such as tables, views, stored procedures, functions, and other supported database objects. DACPAC files are commonly used with SQL Server Data Tools (SSDT), database projects, schema comparison, and CI/CD deployments.
Quick answer: In SQL Server Management Studio (SSMS), right-click the database, select Tasks → Extract Data-tier Application, complete the wizard, and save the resulting .dacpac file. For automation, use Microsoft SqlPackage with /Action:Extract.
DACPAC vs BACPAC
DACPAC and BACPAC files serve different purposes:
| Package | Contains | Typical use |
|---|---|---|
| DACPAC | Database schema | Schema deployment, database projects, and CI/CD |
| BACPAC | Database schema and data | Database export and import |
Creating a DACPAC is not a mandatory prerequisite for creating a BACPAC. Choose the package based on whether you need schema only or schema together with data.
Things to check before creating a DACPAC
Before extracting the DACPAC, review the source database and the platform where you intend to deploy it. Extraction may succeed even when the target platform does not support every source feature.
- Schema and references: Check for unresolved references, broken dependencies, and invalid objects.
- Cross-database dependencies: Review three-part and four-part references, synonyms, views, procedures, and functions that depend on another database.
- Server-level objects: Logins, SQL Server Agent jobs, credentials, operators, linked servers, and Database Mail configuration are not normally deployed as database schema objects by a DACPAC.
- CLR and other platform-specific features: Validate whether the target SQL platform supports the source features.
- Permissions: Confirm that the account creating the DACPAC can connect to the database and read the required metadata.
- Target compatibility: If the destination is Azure SQL Database, check Azure SQL Database limitations before deployment.
Method 1: Create a DACPAC using SQL Server Management Studio
SSMS provides a graphical wizard and is usually the simplest option for a one-time extraction.
- Open SSMS and connect to the source SQL Server instance.
- In Object Explorer, expand Databases.
- Right-click the database and select Tasks → Extract Data-tier Application.
- On the wizard screens, provide the DAC properties and choose the output location for the
.dacpacfile. - Review the validation and summary screen.
- Select Next to start the extraction and wait for the wizard to complete.
Available on Microsoft Store
SSRS Reports Migration Wizard
A simple Windows tool for migrating SSRS reports, data sources, and related configurations between report servers.
Method 2: Create a DACPAC using Microsoft SqlPackage
SqlPackage is Microsoft’s command-line utility for database operations such as Extract, Publish, Script, DeployReport, and Export. It is useful for repeatable scripts, automation, and CI/CD pipelines.
Install and verify SqlPackage
Download SqlPackage from Microsoft’s official documentation and install or extract it according to your operating system. Avoid assuming that every installation uses the same folder.

After installation, open a new PowerShell window and verify that SqlPackage is available on the PATH:
sqlpackage /Version

If PowerShell reports that sqlpackage is not recognized, run it from the folder containing the executable or add that folder to the PATH environment variable. Open a new terminal after changing PATH.
Extract a DACPAC using Windows authentication
The following example extracts the schema of the Sales database from the local SQL Server instance:
$SourceServerName = "."
$SourceDatabaseName = "Sales"
$OutputFolder = "D:\Dacpacs"
New-Item -ItemType Directory -Path $OutputFolder -Force | Out-Null
sqlpackage `
/Action:Extract `
/SourceServerName:$SourceServerName `
/SourceDatabaseName:$SourceDatabaseName `
/TargetFile:"$OutputFolder\$SourceDatabaseName.dacpac" `
/DiagnosticsFile:"$OutputFolder\$SourceDatabaseName.log"
When Windows authentication is used, SqlPackage runs under the identity of the current Windows user. That identity must have the required access to the source database and the output folder.
Extract a DACPAC using a connection string
You can also provide a source connection string. Keep passwords out of source control, scripts committed to Git, and pipeline logs.
sqlpackage `
/Action:Extract `
/SourceConnectionString:"Server=localhost;Database=Sales;Integrated Security=True;TrustServerCertificate=True" `
/TargetFile:"D:\Dacpacs\Sales.dacpac" `
/DiagnosticsFile:"D:\Dacpacs\Sales.log"
How to validate the generated DACPAC
- Confirm that the
.dacpacfile exists in the target folder. - Review the diagnostics log for warnings or errors.
- Open the DACPAC in a database project or schema comparison tool if you need to inspect the extracted schema.
- Test deployment against a non-production database.
- Review the generated deployment script or deployment report before production deployment.
Common DACPAC extraction problems
| Problem | Possible cause | What to check |
|---|---|---|
| SQL Server connection fails | Incorrect server name, network, or firewall | Test the connection in SSMS. |
| Login or permission error | The account cannot read database metadata | Check database access and permissions. |
| SqlPackage is not recognized | The executable is not on PATH | Run from the installation folder or update PATH. |
| Extraction reports unresolved references | Broken dependencies or unsupported references | Review the affected objects and diagnostic log. |
| Output file cannot be created | The folder does not exist or is not writable | Create the folder and check file-system permissions. |
| Deployment fails after extraction | The target platform does not support a source feature | Validate the DACPAC against the intended target. |
How can I open a DACPAC file in Visual Studio?
You can refer to How to Open a DACPAC File in Visual Studio if you want to create a database project from an existing DACPAC file.
How to deploy a DACPAC to Azure SQL Database
After extracting the DACPAC, you can deploy it using SSMS, SqlPackage, a database project, Azure DevOps, or another CI/CD workflow. Review the deployment script or report first, especially when deploying changes to production.
For the next step, read How to Deploy a DACPAC to Azure SQL Database.
Pro tips:
1. SqlPackage supports additional parameters for authentication, filtering, diagnostics, and deployment behavior. Review the official SqlPackage documentation for the action and parameters you are using.
2. If you run the extraction from SQL Server Agent, an automation runner, or a CI/CD agent, ensure that its identity can access the source database and the output folder.
3. If you need a package containing both schema and data, read Create a BACPAC File From SQL Database instead.
See more
Visual Studio Marketplace
SSIS Catalog Migration Wizard
Extend Visual Studio with an easy way to migrate SSIS Catalog projects.
Kunal Rathi
With over 15 years of experience in data engineering and analytics, I've assisted countless clients in gaining valuable insights from their data. As a dedicated supporter of Data, Cloud and DevOps, I'm excited to connect with individuals who share my passion for this field. If my work resonates with you, we can talk and collaborate.






