SQL Azure and Powershell for DACPAC deploy SQL Azure and Powershell for DACPAC deploy powershell powershell

SQL Azure and Powershell for DACPAC deploy


If you installed latest SSDT 2015 (https://msdn.microsoft.com/en-us/mt186501). I highly recommended it because it has a lot of useful options for the Publish profile, which can be generated using Visual Studio.

You can use the following to publish your file to Azure using Powershell

$sqlpackage = "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120\sqlpackage.exe"$dbserver = "<Azure DB Location>"  $database = "<name of DB on Server>"# UNC Paths$dbProfile = "<Path to your Publish Profile>"$mydacpac = "<location of the dacpac>" # Publish Command& $sqlpackage /Action:Publish /tsn:$dbServer /tdn:$database /sf:$mydacpac/pr:$dbProfile /variables:myVariable=1

PS : & works like Invoke-Expression mentioned by Pradebban


Try publishing with sqlpackage.exe and Publish.xml

Invoke-Expression = "C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe /Action:Publish /Sourcefile:<.dacpac file_path> /pr:'<Publish.xml>'"