次の方法で共有


SqlAzureDacpacDeployment@1 - Azure SQL Database デプロイ v1 タスク

このタスクを使用して、DACPAC を使用して Azure SQL Database をデプロイするか、SQLCMD を使用してスクリプトを実行します。

構文

# Azure SQL Database deployment v1
# Deploy an Azure SQL Database using DACPAC or run scripts using SQLCMD.
- task: SqlAzureDacpacDeployment@1
  inputs:
    #azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName' | 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure Service Connection Type. Default: ConnectedServiceNameARM.
    #azureClassicSubscription: # string. Alias: ConnectedServiceName. Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure Classic Subscription. 
    azureSubscription: # string. Alias: ConnectedServiceNameARM. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure Subscription. 
  # SQL Database
    AuthenticationType: 'server' # 'server' | 'aadAuthenticationPassword' | 'aadAuthenticationIntegrated' | 'connectionString' | 'servicePrincipal'. Required. Authentication Type. Default: server.
    #ServerName: # string. Required when AuthenticationType = server || AuthenticationType = aadAuthenticationPassword || AuthenticationType = aadAuthenticationIntegrated || AuthenticationType = servicePrincipal. Azure SQL Server. 
    #DatabaseName: # string. Required when AuthenticationType = server || AuthenticationType = aadAuthenticationPassword || AuthenticationType = aadAuthenticationIntegrated || AuthenticationType = servicePrincipal. Database. 
    SqlUsername: # string. Required when AuthenticationType = server. Login. 
    SqlPassword: # string. Required when AuthenticationType = server. Password. 
    #aadSqlUsername: # string. Required when AuthenticationType = aadAuthenticationPassword. Login. 
    #aadSqlPassword: # string. Required when AuthenticationType = aadAuthenticationPassword. Password. 
    #ConnectionString: # string. Required when AuthenticationType = connectionString. Connection String. 
  # Deployment Package
    deployType: 'DacpacTask' # 'DacpacTask' | 'SqlTask' | 'InlineSqlTask'. Alias: TaskNameSelector. Required. Deploy type. Default: DacpacTask.
    DeploymentAction: 'Publish' # 'Publish' | 'Extract' | 'Export' | 'Import' | 'Script' | 'DriftReport' | 'DeployReport'. Required when TaskNameSelector = DacpacTask. Action. Default: Publish.
    #DacpacFile: # string. Required when DeploymentAction = Publish || DeploymentAction = Script || DeploymentAction = DeployReport. DACPAC File. 
    #BacpacFile: # string. Required when DeploymentAction = Import. BACPAC File. 
    #SqlFile: # string. Required when TaskNameSelector = SqlTask. SQL Script. 
    #SqlInline: # string. Required when TaskNameSelector = InlineSqlTask. Inline SQL Script. 
    #PublishProfile: # string. Optional. Use when TaskNameSelector = DacpacTask || DeploymentAction = Script || DeploymentAction = DeployReport. Publish Profile. 
    #AdditionalArguments: # string. Optional. Use when TaskNameSelector = DacpacTask || DeploymentAction = Extract || DeploymentAction = Export || DeploymentAction = Import || DeploymentAction = Script || DeploymentAction = DeployReport || DeploymentAction = DriftReport. Additional SqlPackage.exe Arguments. 
    #SqlAdditionalArguments: # string. Optional. Use when TaskNameSelector = SqlTask. Additional Invoke-Sqlcmd Arguments. 
    #InlineAdditionalArguments: # string. Optional. Use when TaskNameSelector = InlineSqlTask. Additional Invoke-Sqlcmd 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 SQL Database deployment v1
# Deploy an Azure SQL Database using DACPAC or run scripts using SQLCMD.
- task: SqlAzureDacpacDeployment@1
  inputs:
    #azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName' | 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure Service Connection Type. Default: ConnectedServiceNameARM.
    #azureClassicSubscription: # string. Alias: ConnectedServiceName. Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure Classic Subscription. 
    azureSubscription: # string. Alias: ConnectedServiceNameARM. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure Subscription. 
  # SQL Database
    AuthenticationType: 'server' # 'server' | 'aadAuthenticationPassword' | 'aadAuthenticationIntegrated' | 'connectionString'. Required. Authentication Type. Default: server.
    #ServerName: # string. Required when AuthenticationType = server || AuthenticationType = aadAuthenticationPassword || AuthenticationType = aadAuthenticationIntegrated. Azure SQL Server. 
    #DatabaseName: # string. Required when AuthenticationType = server || AuthenticationType = aadAuthenticationPassword || AuthenticationType = aadAuthenticationIntegrated. Database. 
    SqlUsername: # string. Required when AuthenticationType = server. Login. 
    SqlPassword: # string. Required when AuthenticationType = server. Password. 
    #aadSqlUsername: # string. Required when AuthenticationType = aadAuthenticationPassword. Login. 
    #aadSqlPassword: # string. Required when AuthenticationType = aadAuthenticationPassword. Password. 
    #ConnectionString: # string. Required when AuthenticationType = connectionString. Connection String. 
  # Deployment Package
    deployType: 'DacpacTask' # 'DacpacTask' | 'SqlTask' | 'InlineSqlTask'. Alias: TaskNameSelector. Required. Deploy type. Default: DacpacTask.
    DeploymentAction: 'Publish' # 'Publish' | 'Extract' | 'Export' | 'Import' | 'Script' | 'DriftReport' | 'DeployReport'. Required when TaskNameSelector = DacpacTask. Action. Default: Publish.
    #DacpacFile: # string. Required when DeploymentAction = Publish || DeploymentAction = Script || DeploymentAction = DeployReport. DACPAC File. 
    #BacpacFile: # string. Required when DeploymentAction = Import. BACPAC File. 
    #SqlFile: # string. Required when TaskNameSelector = SqlTask. SQL Script. 
    #SqlInline: # string. Required when TaskNameSelector = InlineSqlTask. Inline SQL Script. 
    #PublishProfile: # string. Optional. Use when TaskNameSelector = DacpacTask || DeploymentAction = Script || DeploymentAction = DeployReport. Publish Profile. 
    #AdditionalArguments: # string. Optional. Use when TaskNameSelector = DacpacTask || DeploymentAction = Extract || DeploymentAction = Export || DeploymentAction = Import || DeploymentAction = Script || DeploymentAction = DeployReport || DeploymentAction = DriftReport. Additional SqlPackage.exe Arguments. 
    #SqlAdditionalArguments: # string. Optional. Use when TaskNameSelector = SqlTask. Additional Invoke-Sqlcmd Arguments. 
    #InlineAdditionalArguments: # string. Optional. Use when TaskNameSelector = InlineSqlTask. Additional Invoke-Sqlcmd 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.

入力

azureConnectionType - Azure サービス接続の種類
入力エイリアス: ConnectedServiceNameSelectorstring. 使用できる値: ConnectedServiceName (Azure クラシック)、ConnectedServiceNameARM (Azure Resource Manager)。 既定値: ConnectedServiceNameARM.


Azure クラシック サブスクリプションazureClassicSubscription -
入力エイリアス: ConnectedServiceNamestring. ConnectedServiceNameSelector = ConnectedServiceNameする場合に必要です。

SQL ファイルをデプロイするためのターゲット Azure クラシック サブスクリプションを指定します。


Azure サブスクリプションazureSubscription -
入力エイリアス: ConnectedServiceNameARMstring. ConnectedServiceNameSelector = ConnectedServiceNameARMする場合に必要です。

SQL ファイルをデプロイするためのターゲット Azure Resource Manager サブスクリプションを指定します。


AuthenticationType - 認証の種類
string. 必須。 使用できる値: server (SQL Server 認証)、aadAuthenticationPassword (Active Directory - パスワード)、aadAuthenticationIntegrated (Active Directory - 統合)、connectionString (接続文字列)、servicePrincipal (サービス プリンシパル)。 既定値: server.

データベース認証の種類を指定します。 SQL Server、Active Directory (統合)、Active Directory (パスワード)、接続文字列、またはサービス プリンシパル認証を指定できます。 統合認証では、エージェントは現在の Active Directory アカウント コンテキストを使用してデータベースにアクセスします。

Azure SQL Server データベースに接続するオプションを指定します。 Azure SQL Server データベースの詳細、SQL Server 接続文字列、AD 認証 (パスワードまたは統合)、またはサービス プリンシパルを使用できます。 SQL Server 認証の場合は、SQL Server のユーザー資格情報を使用します。 AD 認証の場合は、SQL Server に構成されている AD ユーザーの資格情報を使用します。


AuthenticationType - 認証の種類
string. 必須。 使用できる値: server (SQL Server 認証)、aadAuthenticationPassword (Active Directory - パスワード)、aadAuthenticationIntegrated (Active Directory - 統合)、connectionString (接続文字列)。 既定値: server.

データベース認証の種類を指定します。 SQL Server、Active Directory (統合)、Active Directory (パスワード)、接続文字列、またはサービス プリンシパル認証を指定できます。 統合認証では、エージェントは現在の Active Directory アカウント コンテキストを使用してデータベースにアクセスします。

Azure SQL Server データベースに接続するオプションを指定します。 Azure SQL Server データベースの詳細、SQL Server 接続文字列、AD 認証 (パスワードまたは統合)、またはサービス プリンシパルを使用できます。 SQL Server 認証の場合は、SQL Server のユーザー資格情報を使用します。 AD 認証の場合は、SQL Server に構成されている AD ユーザーの資格情報を使用します。


Azure SQL ServerServerName -
string. AuthenticationType = server || AuthenticationType = aadAuthenticationPassword || AuthenticationType = aadAuthenticationIntegrated || AuthenticationType = servicePrincipalする場合に必要です。

Fabrikam.database.windows.net.placeholder,1433Fabrikam.database.windows.net.placeholderなど、Azure SQL Server の名前を指定します。


Azure SQL ServerServerName -
string. AuthenticationType = server || AuthenticationType = aadAuthenticationPassword || AuthenticationType = aadAuthenticationIntegratedする場合に必要です。

Fabrikam.database.windows.net.placeholder,1433Fabrikam.database.windows.net.placeholderなど、Azure SQL Server の名前を指定します。


DatabaseName - Database
string. AuthenticationType = server || AuthenticationType = aadAuthenticationPassword || AuthenticationType = aadAuthenticationIntegrated || AuthenticationType = servicePrincipalする場合に必要です。

ファイルがデプロイされる Azure SQL データベースの名前を指定します。


DatabaseName - Database
string. AuthenticationType = server || AuthenticationType = aadAuthenticationPassword || AuthenticationType = aadAuthenticationIntegratedする場合に必要です。

ファイルがデプロイされる Azure SQL データベースの名前を指定します。


SqlUsername - ログイン
string. AuthenticationType = serverする場合に必要です。

Azure SQL Server 管理者ログインを指定します。


SqlPassword - パスワード
string. AuthenticationType = serverする場合に必要です。

Azure SQL Server 管理者のパスワードを指定します。 $(passwordVariable) としてビルド パイプラインまたはリリース パイプラインで定義されている変数が受け入れられます。 変数型をセキュリティで保護するために、secret としてマークできます。


aadSqlUsername - ログイン
string. AuthenticationType = aadAuthenticationPasswordする場合に必要です。

Active Directory ユーザー名を指定します。


aadSqlPassword - パスワード
string. AuthenticationType = aadAuthenticationPasswordする場合に必要です。

Active Directory ユーザーのパスワードを指定します。 $(passwordVariable) としてビルド パイプラインまたはリリース パイプラインで定義されている変数が受け入れられます。 変数型をセキュリティで保護するために、secret としてマークできます。


接続文字列ConnectionString -
string. AuthenticationType = connectionStringする場合に必要です。

Server=testServer.database.windows.net.placeholder;Database=testdb;User ID=AccountPlaceholder;Password=$(securePassword);など、Azure SQL Server 接続文字列を指定します。


deployType - 展開の種類
入力エイリアス: TaskNameSelectorstring. 必須。 使用できる値: DacpacTask (SQL DACPAC ファイル)、SqlTask (SQL スクリプト ファイル)、InlineSqlTask (インライン SQL スクリプト)。 既定値: DacpacTask.


DeploymentAction - アクションの
string. TaskNameSelector = DacpacTaskする場合に必要です。 使用できる値: PublishExtractExportImportScriptDriftReport (ドリフト レポート)、DeployReport (配置レポート)。 既定値: Publish.

一覧から SQL アクションのいずれかを指定します。 SQL アクションの一覧の詳細については、を参照してください。


DacpacFile - DACPAC ファイルの
string. DeploymentAction = Publish || DeploymentAction = Script || DeploymentAction = DeployReportする場合に必要です。

オートメーション エージェントまたはオートメーション エージェントからアクセスできる UNC パス上の DACPAC ファイルの場所 (\\BudgetIT\Web\Deploy\FabrikamDB.dacpacなど) を指定します。 $(agent.releaseDirectory)などの定義済みのシステム変数も使用できます。


BACPACファイルのBacpacFile - する
string. DeploymentAction = Importする場合に必要です。

automation エージェントまたはオートメーション エージェントからアクセスできる UNC パス上の BACPAC ファイルの場所 (\\BudgetIT\Web\Deploy\FabrikamDB.bacpacなど) を指定します。 $(agent.releaseDirectory)などの定義済みのシステム変数も使用できます。


SQL スクリプトSqlFile -
string. TaskNameSelector = SqlTaskする場合に必要です。

\\BudgetIT\Web\Deploy\FabrikamDB.sqlなど、オートメーション エージェントまたはオートメーション エージェントからアクセスできる UNC パス上の SQL スクリプト ファイルの場所を指定します。 $(agent.releaseDirectory)などの定義済みのシステム変数も使用できます。


インライン SQL スクリプトSqlInline -
string. TaskNameSelector = InlineSqlTaskする場合に必要です。

以前に選択したデータベースで実行する SQL スクリプトを指定します。


プロファイルの発行PublishProfile -
string. 任意 TaskNameSelector = DacpacTask || DeploymentAction = Script || DeploymentAction = DeployReportするときに使用します。

Azure SQL データベースの作成またはアップグレードをきめ細かく制御できます。
Automation エージェント コンピューターまたは UNC 共有上の発行プロファイル XML ファイルへのパスを指定します。 発行プロファイルに資格情報などのシークレットが含まれている場合は、セキュリティで保護されたファイル ライブラリにアップロードし、暗号化を使用して安全に保存します。 次に、パイプラインの開始時に セキュリティで保護されたファイル のダウンロード タスクを使用して、パイプラインの実行時にエージェント コンピューターにダウンロードします。 パイプラインが完了したら、それを削除します。 $(agent.buildDirectory)$(agent.releaseDirectory)などの定義済みのシステム変数も使用できます。


AdditionalArguments - 追加の SqlPackage.exe 引数
string. 任意 TaskNameSelector = DacpacTask || DeploymentAction = Extract || DeploymentAction = Export || DeploymentAction = Import || DeploymentAction = Script || DeploymentAction = DeployReport || DeploymentAction = DriftReportするときに使用します。

DACPAC オプションが選択されている場合に Azure SQL データベースのデプロイ時に適用される追加の SqlPackage.exe 引数 (/p:IgnoreAnsiNulls=True /p:IgnoreComments=Trueなど) を指定します。 これらの引数は、発行プロファイル XML ファイルの設定 (指定されている場合) をオーバーライドします。


SqlAdditionalArguments - 追加の Invoke-Sqlcmd 引数
string. 任意 TaskNameSelector = SqlTaskするときに使用します。

-ConnectionTimeout 100 -OutputSqlErrorsなど、Azure SQL データベースで特定の SQL クエリを実行するときに適用される追加の Invoke-Sqlcmd 引数を指定します。


InlineAdditionalArguments - 追加の Invoke-Sqlcmd 引数
string. 任意 TaskNameSelector = InlineSqlTaskするときに使用します。

-ConnectionTimeout 100 -OutputSqlErrorsなど、Azure SQL Database で特定の SQL クエリを実行するときに適用される追加の Invoke-Sqlcmd 引数を指定します。


IpDetectionMethod - を使用してファイアウォール規則を指定する
string. 必須。 使用できる値: AutoDetectIPAddressRange。 既定値: AutoDetect.

タスクを実行するには、Automation エージェントの IP アドレスを Azure SQL Server のファイアウォールの 許可 IP アドレスに追加する必要があります。 自動検出を選択して、自動化エージェントの使用可能な IP アドレスの範囲に対してファイアウォール例外を自動的に追加するか、範囲を明示的に指定します。


StartIpAddress - 開始 IP アドレス
string. IpDetectionMethod = IPAddressRangeする場合に必要です。

196.21.30.50など、Automation エージェント マシン プールの開始 IP アドレスを指定します。


EndIpAddress - エンド IP アドレスの
string. IpDetectionMethod = IPAddressRangeする場合に必要です。

196.21.30.65など、Automation エージェント マシン プールの終了 IP アドレスを指定します。


DeleteFirewallRule - タスクの終了後にルールを削除
boolean. 既定値: true.

選択した場合、タスクが終了すると、ここで指定した IP アドレスが、Azure SQL Server のファイアウォールの 許可された IP アドレス 一覧から削除されます。


タスク コントロールのオプション

すべてのタスクには、タスク入力に加えて制御オプションがあります。 詳細については、「コントロール オプションと一般的なタスク プロパティを参照してください。

出力変数

このタスクでは、次の 出力変数を定義します。この変数は、ダウンストリームのステップ、ジョブ、およびステージで使用できます。

SqlDeploymentOutputFile
展開パッケージアクションが ExtractExportScriptDriftReport、または DeployReportされたときに生成される出力ファイルパス。

注釈

このタスクを使用して、DACPAC を使用して Azure SQL データベースをデプロイするか、SQLCMD を使用してスクリプトを実行します。

重要

このタスクは、Windows 環境でのみサポートされます。 Azure Active Directory (Azure AD) 統合認証を使用する場合は、プライベート エージェントを作成する必要があります。 Azure AD 統合認証は、ホストされているエージェントではサポートされていません。

必要条件

要件 説明
パイプラインの種類 YAML、クラシック ビルド、クラシック リリース
実行日 エージェント
の需要 セルフホステッド エージェントには、このタスクを使用するジョブを実行するための 次の 要求に一致する 機能 が必要です。
機能の このタスクは、ジョブ内の後続のタスクに対する要求を満たしていません。
コマンドの制限 どれでも
設定可能な変数 どれでも
エージェントのバージョン 1.103.0 以上
タスク カテゴリ 展開