Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 95bd81f

Browse files
committed
publish examples
1 parent 28705a3 commit 95bd81f

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

docs/tools/sqlpackage/sqlpackage-publish.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.assetid: 198198e2-7cf4-4a21-bda4-51b36cb4284b
99
author: "dzsquared"
1010
ms.author: "drskwier"
1111
ms.reviewer: "maghan"
12-
ms.date: 1/25/2022
12+
ms.date: 7/29/2022
1313
---
1414

1515
# SqlPackage Publish parameters, properties, and SQLCMD variables
@@ -20,12 +20,35 @@ The SqlPackage.exe publish operation incrementally updates the schema of a targe
2020
**SqlPackage.exe** initiates the actions specified using the parameters, properties, and SQLCMD variables specified on the command line.
2121

2222
```bash
23-
SqlPackage {parameters}{properties}{SQLCMD Variables}
23+
SqlPackage /Action:Publish {parameters} {properties} {sqlcmd variables}
2424
```
2525

2626
> [!NOTE]
2727
> When a database with SQL authentication user credentials is extracted, the password is replaced with a different password of suitable complexity. It is assumed that after the dacpac is published that the user password is changed.
2828
29+
### Examples
30+
31+
```bash
32+
# example publish from Azure SQL Database using SQL authentication and a connection string
33+
SqlPackage /Action:Publish /SourceFile:"C:\AdventureWorksLT.dacpac" \
34+
/TargetConnectionString:"Server=tcp:{yourserver}.database.windows.net,1433;Initial Catalog=AdventureWorksLT;Persist Security Info=False;User ID=sqladmin;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
35+
36+
# example publish using short form parameter names, skips schema validation
37+
SqlPackage /a:Publish /tsn:"{yourserver}.database.windows.net,1433" /tdn:"AdventureWorksLT" /tu:"sqladmin" \
38+
/tp:"{your_password}" /sf:"C:\AdventureWorksLT.dacpac" /p:VerifyExtraction=False
39+
40+
# example publish using Azure Active Directory Service Principal
41+
SqlPackage /Action:Publish /SourceFile:"C:\AdventureWorksLT.dacpac" \
42+
/TargetConnectionString:"Server=tcp:{yourserver}.database.windows.net,1433;Initial Catalog=AdventureWorksLT;Authentication=Active Directory Service Principal;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
43+
44+
# example publish with 2 SQLCMD variables
45+
# as seen in a post deployment script for user passwords
46+
# https://github.com/Azure-Samples/app-sql-devops-demo-project/blob/main/sql/wwi-dw-ssdt/PostDeploymentScripts/AddUsers.sql
47+
SqlPackage /Action:Publish /SourceFile:"C:\AdventureWorksLT.dacpac" \
48+
/TargetConnectionString:"Server=tcp:{yourserver}.database.windows.net,1433;Initial Catalog=AdventureWorksLT;Persist Security Info=False;User ID=sqladmin;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" \
49+
/v:ETLUserPassword="asecurestringaddedhere" /v:AppUserPassword="asecurestringaddedhere"
50+
```
51+
2952

3053
## Parameters for the Publish action
3154

@@ -51,7 +74,7 @@ SqlPackage {parameters}{properties}{SQLCMD Variables}
5174
|**/SourceConnectionString:**|**/scs**|{string}|Specifies a valid SQL Server/Azure connection string to the source database. If this parameter is specified, it shall be used exclusively of all other source parameters. |
5275
|**/SourceDatabaseName:**|**/sdn**|{string}|Defines the name of the source database. |
5376
|**/SourceEncryptConnection:**|**/sec**|{True|False}|Specifies if SQL encryption should be used for the source database connection. |
54-
|**/SourceFile:**|**/sf**|{string}|Specifies a source file to be used as the source of action instead of a database. If this parameter is used, no other source parameter shall be valid. |
77+
|**/SourceFile:**|**/sf**|{string}|Specifies a source file to be used as the source of action instead of a database from local storage. If this parameter is used, no other source parameter shall be valid. |
5578
|**/SourcePassword:**|**/sp**|{string}|For SQL Server Auth scenarios, defines the password to use to access the source database. |
5679
|**/SourceServerName:**|**/ssn**|{string}|Defines the name of the server hosting the source database. |
5780
|**/SourceTimeout:**|**/st**|{int}|Specifies the timeout for establishing a connection to the source database in seconds. |

0 commit comments

Comments
 (0)