使用此工作,使用 DACPAC 或 SQL 腳本來部署 SQL Server 資料庫。
語法
# This task is supported on classic release pipelines only.
# Use the classic designer to add and configure this task in a classic release pipeline.
# See the following Inputs section for details on the inputs that this task supports.
輸入
TaskType
-
使用 部署 SQL
string
。 必須的。 允許的值:dacpac
(Sql Dacpac)、sqlQuery
(Sql 查詢檔)、sqlInline
(內嵌 Sql)。 預設值:dacpac
。
指定您想要部署資料庫的方式:使用 Dacpac 或 SQL 腳稿。
DacpacFile
-
DACPAC 檔案
string
。
TaskType = dacpac
時為必要項。
指定目標電腦或 UNC 路徑上 DACPAC 檔案的位置,例如 \\BudgetIT\Web\Deploy\FabrikamDB.dacpac
。 計算機系統管理員帳戶應該可以存取 UNC 路徑。 也支援環境變數,例如 $env:windir
、$env:systemroot
或 $env:windir\FabrikamFibre\DB
。 可使用萬用字元。 例如,**/*.dacpac
存在於所有子資料夾中的 DACPAC 檔案。
SqlFile
-
Sql 檔案
string
。
TaskType = sqlQuery
時為必要項。
指定目標上 SQL 檔案的位置。 提供分號分隔的 SQL 腳本檔案清單,以執行多個檔案。 SQL 文稿會依指定的順序執行。 位置也可以是 UNC 路徑,例如 \\BudgetIT\Web\Deploy\FabrikamDB.sql
。 計算機系統管理員帳戶應該可以存取 UNC 路徑。 也支援環境變數,例如 $env:windir
、$env:systemroot
或 $env:windir\FabrikamFibre\DB
。 可使用萬用字元。 例如,**/*.sql
存在於所有子資料夾中的 SQL 檔案。
ExecuteInTransaction
-
在交易 內執行
boolean
。 選擇性。
TaskType = sqlQuery
時使用 。 預設值:false
。
在交易內執行 SQL 腳本。
執行腳本時,ExclusiveLock
- 取得獨佔應用程序鎖定
boolean
。 選擇性。
ExecuteInTransaction = true
時使用 。 預設值:false
。
在執行文稿時取得獨佔應用程序鎖定。
AppLockName
-
應用程式鎖定名稱
string
。
ExclusiveLock = true
時為必要項。
指定應用程式鎖定名稱。
InlineSql
-
內嵌 Sql
string
。
TaskType = sqlInline
時為必要項。
指定 SQL 查詢內嵌。
TargetMethod
-
使用 指定 SQL
string
。
TaskType = dacpac
時為必要項。 允許的值:server
、connectionString
(連接字串)、publishProfile
(發行配置檔)。 預設值:server
。
指定連接到目標 SQL Server 資料庫的選項。 您可以提供 SQL Server 資料庫詳細資料、SQL Server 連接字串或發行設定檔 XML 檔案。
ServerName
-
伺服器名稱
string
。
TargetMethod = server || TaskType = sqlQuery || TaskType = sqlInline
時為必要項。 預設值:localhost
。
指定 SQL Server 名稱,例如 machinename\FabriakmSQL,1433
、localhost
或 .\SQL2012R2
。 指定 localhost
會連線到機器上的預設 SQL Server 實例。
DatabaseName
-
資料庫名稱
string
。
TargetMethod = server || TaskType = sqlQuery || TaskType = sqlInline
時為必要項。
指定 SQL Server 資料庫的名稱。
AuthScheme
-
驗證
string
。
TargetMethod = server || TaskType = sqlQuery || TaskType = sqlInline
時為必要項。 允許的值:windowsAuthentication
(Windows 驗證)、sqlServerAuthentication
(SQL Server 驗證)。 預設值:windowsAuthentication
。
指定連線到 SQL Server 的驗證模式。 在 Windows 驗證模式中,用來設定部署代理程式的帳戶會用來連線到 SQL Server。 在 SQL Server 驗證模式中,必須在下列參數中提供 SQL 登入和密碼。
SqlUsername
-
SQL 使用者名稱
string
。
AuthScheme = sqlServerAuthentication
時為必要項。
指定要連線到 SQL Server 的 SQL 登入。 只有在已選取 SQL Server 驗證模式時,才能使用此選項。
SqlPassword
-
SQL 密碼
string
。
AuthScheme = sqlServerAuthentication
時為必要項。
指定 SQL 登入的密碼。 只有在已選取 SQL Server 驗證模式時,才能使用此選項。
ConnectionString
-
連接字串
string
。
TargetMethod = connectionString
時為必要項。
指定 SQL Server 連接字串,例如 Server=localhost;Database=Fabrikam;User ID=AccountPlaceholder;Password=PasswordPlaceholder;
。
PublishProfile
-
發行配置檔
string
。 選擇性。
TaskType = dacpac
時使用 。
針對 SQL Server 資料庫部署提供更細緻的控制。
指定目標電腦上或計算機系統管理員認證可存取之 UNC 共用上發行配置檔 XML 檔案的路徑。
AdditionalArguments
-
其他自變數
string
。 選擇性。
TaskType = dacpac
時使用 。
指定部署 SQL Server 資料庫時將套用的其他 SqlPackage.exe
自變數,例如 /p:IgnoreAnsiNulls=True
或 /p:IgnoreComments=True
。 這些自變數會覆寫發行配置檔 XML 檔案中的設定(如果提供的話)。
AdditionalArgumentsSql
-
其他自變數
string
。 選擇性。
TaskType = sqlQuery || TaskType = sqlInline
時使用 。
指定部署 SQL Server 資料庫時所套用的其他 Invoke-Sqlcmd
自變數。
工作控制選項
除了工作輸入之外,所有工作都有控制選項。 如需詳細資訊,請參閱 控制項選項和一般工作屬性。
輸出變數
沒有。
需求
要求 | 說明 |
---|---|
管線類型 | 傳統版本 |
執行於 | Agent、DeploymentGroup |
需求 | 沒有 |
功能 | 此工作不符合作業中後續工作的任何需求。 |
命令限制 | 任意 |
Settable 變數 | 任意 |
代理程式版本 | 1.102.0 或更新 |
工作類別 | 部署 |