dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Publish-DbaDacpac

Deploying a dacpac uses the DacFx which historically needed to be installed on a machine prior to use. In 2016 the DacFx was supplied by Microsoft as a nuget package and this uses that nuget package.

Screenshots

dbatools-Publish-DbaDacpac

Examples

Updates WideWorldImporters on sql2017 from the sql2016-WideWorldImporters.dacpac using the sql2016-WideWorldImporters-publish.xml publish profile.

Publish-DbaDacpac -SqlInstance sql2017 -Database WideWorldImporters -Path C:\temp\sql2016-WideWorldImporters.dacpac -PublishXml C:\temp\sql2016-WideWorldImporters-publish.xml

Creates a publish profile at C:\temp\sql2016-db2-publish.xml, exports the .dacpac to $home\Documents\sql2016-db2.dacpac then publishes it to the sql2017 server database db2.

New-DbaPublishProfile -SqlInstance sql2016 -Database db2 -Path C:\temp
Export-DbaDacpac -SqlInstance sql2016 -Database db2 | Publish-DbaDacpac -PublishXml C:\temp\sql2016-db2-publish.xml -Database db1, db2 -SqlInstance sql2017

Author

This command was created by Richie lee. You can find Richie on Twitter.

Get-Help

From PowerShell, execute Get-Help Publish-DbaDacpac -Detailed for more information on this function.

Source Code

Want to see the source code? View Publish-DbaDacpac.ps1 on GitHub
 

Related commands