Share via

sqlpackage missing flags

arielman2304 676 Reputation points
2021-06-07T18:49:53.083+00:00

Hi
I using sqlpackage for publish, but I'm missing the below flags which I used to work with earlier:

Integrated Security  
Persist Security Info  
Pooling  
MultipleActiveResultSets  

I don't see them in the documentation:
https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage-publish?view=sql-server-ver15#parameters-for-the-publish-action

Any idea why they are not there?
More info based on the answers below:
I've forgot to mention it in the question, but when I used the below syntax (using powershell):

$sqlpackage = Start-Process -FilePath sqlpackage.exe -ArgumentList '/Action:Publish','/SourceFile:"Database Services\bin\Release\Database Services.dacpac"',"/p:TargetConnectionString:""Data Source=${Env};Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False;Initial catalog=${Target}""" -wait -PassThru -Credential $Cred  
$sqlpackage.WaitForExit()  
$sqlpackage  

I got this exception:

*** 'TargetConnectionString:Data Source' is not a valid argument for the 'Publish' action.  

So I ended up with this command (which is missing the flags I've mentioned above):

$sqlpackage = Start-Process -FilePath sqlpackage.exe -ArgumentList '/Action:Publish','/SourceFile:"Database Services\bin\Release\Database Services.dacpac"',"/TargetServerName:${Env}","/TargetDatabaseName:${Target}",'/p:BlockOnPossibleDataLoss=True' -wait -PassThru -Credential $Cred  
$sqlpackage.WaitForExit()  
$sqlpackage  
SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories

0 comments No comments

Answer accepted by question author

AmeliaGu-MSFT 14,016 Reputation points Microsoft External Staff
2021-06-08T07:08:07.913+00:00

Hi arielman2304-0180,
Sorry that I am not familiar with PowerShell.
Could you please try to change /p:TargetConnectionString: to /TargetConnectionString: in your command?

$sqlpackage = Start-Process -FilePath sqlpackage.exe -ArgumentList '/Action:Publish','/SourceFile:"Database Services\bin\Release\Database Services.dacpac"',"/p:TargetConnectionString:""Data Source=${Env};Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False;Initial catalog=${Target}""" -wait -PassThru -Credential $Cred
$sqlpackage.WaitForExit()
$sqlpackage

Best Regards,
Amelia

Was this answer helpful?


2 additional answers

Sort by: Most helpful
  1. AmeliaGu-MSFT 14,016 Reputation points Microsoft External Staff
    2021-06-08T03:10:29.957+00:00

    Hi arielman2304-0180,

    As Tom mentioned, the flags are connection string options.
    Please refer to the following docs to view the connection string we can use:
    Connection String Keywords with OLE DB Driver
    DSN and Connection String Keywords

    Best Regards,
    Amelia


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


  2. Tom Phillips 17,786 Reputation points
    2021-06-07T20:39:22.643+00:00

    Those are connection string options, not sqlpackage options.

    You can specify connection string options by using SourceConnectionString and TargetConnectionString parameter.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.