Author | Richie lee (@richiebzzzt) |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out New-DbaDacProfile on GitHub.
Want to see the Bill Of Health for this command? Check out New-DbaDacProfile.
Creates a new Publish Profile.
The New-DbaDacProfile command generates a standard publish profile xml file that can be used by the DacFx (this and everything else) to control the deployment of your dacpac
This generates a standard template XML which is enough to dpeloy a dacpac but it is highly recommended that you add additional options to the publish profile.
If you use Visual Studio you can open a publish.xml file and use the ui to edit the file -
To create a new file, right click on an SSDT project, choose "Publish" then "Load Profile" and load your profile or create a new one.
Once you have loaded it in Visual Studio, clicking advanced shows you the list of options available to you.
For a full list of options that you can add to the profile, google "sqlpackage.exe command line switches" or (https://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx)
New-DbaDacProfile
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[-Database] <String[]>
[[-Path] <String>]
[[-ConnectionString] <String[]>]
[[-PublishOptions] <Hashtable>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> New-DbaDacProfile -SqlInstance sql2017 -SqlCredential ad\sqldba -Database WorldWideImporters -Path C:\temp
In this example, a prompt will appear for alternative credentials, then a connection will be made to sql2017. Using that connection,
the ConnectionString will be extracted and used within the Publish Profile XML file which will be created at C:\temp\sql2017-WorldWideImporters-publish.xml
PS C:\> New-DbaDacProfile -Database WorldWideImporters -Path C:\temp -ConnectionString "SERVER=(localdb)\MSSQLLocalDB;Integrated Security=True;Database=master"
In this example, no connections are made, and a Publish Profile XML would be created at C:\temp\localdb-MSSQLLocalDB-WorldWideImporters-publish.xml
The database name you are targeting
Alias | |
Required | True |
Pipeline | false |
Default Value |
The target SQL Server instance or instances. Alternatively, you can provide a ConnectionString.
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The directory where you would like to save the profile xml file(s).
Alias | |
Required | False |
Pipeline | false |
Default Value | "$home\Documents" |
The connection string to the database you are upgrading.
Alternatively, you can provide a SqlInstance (and optionally SqlCredential) and the script will connect and generate the connectionstring.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Optional hashtable to set publish options. Key/value pairs in the hashtable get converted to strings of "
Alias | |
Required | False |
Pipeline | false |
Default Value |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |