AzureMysqlDeployment@1 - 適用於 MySQL 的 Azure 資料庫 部署 v1 工作

使用此工作來執行文稿,並在 適用於 MySQL 的 Azure 資料庫 中對資料庫進行變更。 適用於 MySQL 的 Azure 資料庫 部署工作僅適用於單一伺服器 適用於 MySQL 的 Azure 資料庫

Syntax

# Azure Database for MySQL deployment v1
# Run your scripts and make changes to your Azure Database for MySQL.
- task: AzureMysqlDeployment@1
  inputs:
    azureSubscription: # string. Alias: ConnectedServiceName. Required. Azure Subscription. 
  # DB Details
    ServerName: # string. Required. Host Name. 
    #DatabaseName: # string. Database Name. 
    SqlUsername: # string. Required. Server Admin Login. 
    SqlPassword: # string. Required. Password. 
  # Deployment Package
    #TaskNameSelector: 'SqlTaskFile' # 'SqlTaskFile' | 'InlineSqlTask'. Type. Default: SqlTaskFile.
    SqlFile: # string. Required when TaskNameSelector = SqlTaskFile. MySQL Script. 
    #SqlInline: # string. Required when TaskNameSelector = InlineSqlTask. Inline MySQL Script. 
    #SqlAdditionalArguments: # string. Additional MySQL Arguments. 
  # Firewall
    IpDetectionMethod: 'AutoDetect' # 'AutoDetect' | 'IPAddressRange'. Required. Specify Firewall Rules Using. Default: AutoDetect.
    #StartIpAddress: # string. Required when IpDetectionMethod = IPAddressRange. Start IP Address. 
    #EndIpAddress: # string. Required when IpDetectionMethod = IPAddressRange. End IP Address. 
    #DeleteFirewallRule: true # boolean. Delete Rule After Task Ends. Default: true.
# Azure Database for MySQL Deployment v1
# Run your scripts and make changes to your Azure Database for MySQL.
- task: AzureMysqlDeployment@1
  inputs:
    azureSubscription: # string. Alias: ConnectedServiceName. Required. Azure Subscription. 
  # DB Details
    ServerName: # string. Required. Host Name. 
    #DatabaseName: # string. Database Name. 
    SqlUsername: # string. Required. Server Admin Login. 
    SqlPassword: # string. Required. Password. 
  # Deployment Package
    #TaskNameSelector: 'SqlTaskFile' # 'SqlTaskFile' | 'InlineSqlTask'. Type. Default: SqlTaskFile.
    SqlFile: # string. Required when TaskNameSelector = SqlTaskFile. MySQL Script. 
    #SqlInline: # string. Required when TaskNameSelector = InlineSqlTask. Inline MySQL Script. 
    #SqlAdditionalArguments: # string. Additional MySQL Arguments. 
  # Firewall
    IpDetectionMethod: 'AutoDetect' # 'AutoDetect' | 'IPAddressRange'. Required. Specify Firewall Rules Using. Default: AutoDetect.
    #StartIpAddress: # string. Required when IpDetectionMethod = IPAddressRange. Start IP Address. 
    #EndIpAddress: # string. Required when IpDetectionMethod = IPAddressRange. End IP Address. 
    #DeleteFirewallRule: true # boolean. Delete Rule After Task Ends. Default: true.

輸入

azureSubscription - Azure 訂用帳戶
輸入別名: ConnectedServiceNamestring. 必要。

若要連線到您的 Azure 帳戶,需要此專案。

若要設定新的服務連線,請從清單中選取 Azure 訂用帳戶,然後按兩下 Authorize

如果您的訂用帳戶未列出,或您想要使用現有的服務主體,您可以使用 或 Manage 按鈕來設定 Azure 服務連線Add


ServerName - 主機名
string. 必要。

適用於 MySQL 伺服器的 Azure 資料庫名稱。

範例: fabrikam.mysql.database.azure.com

伺服器名稱會在 適用於 MySQL 的 Azure 資料庫 伺服器資源的 [概觀] 刀鋒視窗上 Azure 入口網站 提供。

當您使用 MySQL Workbench 進行連線時,這個值與 中Parameters所使用的Hostname值相同。


DatabaseName - 資料庫名稱
string.

選擇性。 資料庫的名稱。 如果資料庫名稱不存在,腳本將會建立資料庫名稱。

如果未指定,請確定在提供的 SQL 檔案或內嵌 SQL 中視需要參考資料庫。

注意:MySQL 資料庫名稱會區分大小寫。


SqlUsername - 伺服器 管理員 登入
string. 必要。

適用於 MySQL 的 Azure 資料庫 伺服器支援原生 MySQL 驗證。 您可以利用伺服器的管理員登入來連接和驗證伺服器。 範例: bbo1@fabrikam.

當您使用 MySQL Workbench 進行連線時,這個值與 中Parameters所使用的Username值相同。


SqlPassword - 密碼
string. 必要。

適用於 MySQL 的 Azure 資料庫的系統管理員密碼。 如果您不記得密碼,您可以從 Azure 入口網站 變更密碼。

此字串可以使用管線中的變數來定義。 範例: $(password).

此外,您可以將變數類型標示為 secret 來保護它。


TaskNameSelector - 類型
string. 允許的值: SqlTaskFile (MySQL 腳本檔案) , InlineSqlTask (內嵌 MySQL 腳本) 。 預設值:SqlTaskFile

選擇性。 選取腳本檔案 & 內嵌腳本之間的其中一個選項。

  • SqlTaskFile (預設) ,以搭配 SqlFile 自變數使用
  • InlineSqlTask,用於搭配 SqlInline 自變數使用。

注意:這些值會區分大小寫。


SqlFile - MySQL 腳本
string. 當 TaskNameSelector = SqlTaskFile 時為必要。

自動化代理程式上腳本檔案的完整路徑,或自動化代理程式可存取的 UNC 路徑。 例如:\BudgetIT\DeployBuilds\script.sql

您可以在這裡使用預先定義的系統變數,例如 $(agent.releaseDirectory),以及包含 SQL 語句的檔案。

注意:MySQL 用戶端偏好 Unix 樣式路徑,因此從 1.183.0 版開始,工作會將 Windows 樣式路徑轉換為 Unix 樣式路徑。 範例:從 c:\foo\bar\myscript.sqlc:/foo/bar/myscript.sql

在Linux平臺上使用工作時,路徑會保持不變。 不需要逸出路徑中的特殊字元。


SqlInline - 內嵌 MySQL 腳本
string. 當 TaskNameSelector = InlineSqlTask 時為必要。

輸入 MySQL 腳本,以在上面選取的資料庫上執行。


SqlAdditionalArguments - 其他 MySQL 自變數
string.

選擇性。 MySQL 用戶端支援的其他選項。 這些選項會在 適用於 MySQL 的 Azure 資料庫 上執行指定的檔案時套用。

範例:您可以變更為預設索引標籤分隔輸出格式、HTML 或甚至 XML 格式。 其他範例包括:

  • --comments 以移除從客戶端傳送至伺服器的批注。
  • --quick 以防止結果快取。
  • --xml 將結果輸出為 XML。

MySQL 用戶端檔中會說明所有可用的選項。


IpDetectionMethod - 使用 指定防火牆規則
string. 必要。 允許值:AutoDetectIPAddressRange。 預設值:AutoDetect

若要順利執行工作,我們必須讓系統管理員從自動化代理程式的IP位址存取 適用於 MySQL 的 Azure 資料庫 伺服器。

藉由選取自動偵測,您可以針對自動化代理程式可能的IP位址範圍自動新增防火牆例外狀況,或者您可以明確指定範圍。

接受的值:

  • AutoDetect 以自動偵測自動化代理程式的公用IP位址。
  • IPAddressRange 以明確指定要設定的IP位址範圍。 使用 StartIpAddressEndIpAddress 參數設定IP位址範圍。

注意:這些值會區分大小寫。


StartIpAddress - 起始IP位址
string. 當 IpDetectionMethod = IPAddressRange 時為必要。

自動化代理程式計算機集區的起始IP位址。 例如:196.21.30.50


EndIpAddress - 結束IP位址
string. 當 IpDetectionMethod = IPAddressRange 時為必要。

自動化代理程式計算機集區的結束IP位址。 例如:196.21.30.65


DeleteFirewallRule - 工作結束後的刪除規則
boolean. 預設值:true

選擇性。 如果選取,將會針對對應的 適用於 MySQL 的 Azure 資料庫 移除自動化代理程式IP位址的新增例外狀況。


工作控制選項

除了工作輸入之外,所有工作都有控制選項。 如需詳細資訊,請參閱 控件選項和一般工作屬性

輸出變數

無。

備註

使用此工作來執行文稿,並在 適用於 MySQL 的 Azure 資料庫 中對資料庫進行變更。 請注意,這是預覽版本。 適用於 MySQL 的 Azure 資料庫 部署工作僅適用於單一伺服器 適用於 MySQL 的 Azure 資料庫

規格需求

需求 描述
管線類型 YAML、傳統組建、傳統版本
在上執行 代理程式
要求
Capabilities 此工作不符合作業中後續工作的任何需求。
命令限制 任何
可設定變數 任何
代理程式版本 1.100.0 或更新版本
工作類別 部署