このタスクを使用して、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 サービス接続の種類
入力エイリアス: ConnectedServiceNameSelector
。
string
. 使用できる値: ConnectedServiceName
(Azure クラシック)、ConnectedServiceNameARM
(Azure Resource Manager)。 既定値: ConnectedServiceNameARM
.
Azure クラシック サブスクリプションの azureClassicSubscription
-
入力エイリアス: ConnectedServiceName
。
string
.
ConnectedServiceNameSelector = ConnectedServiceName
する場合に必要です。
SQL ファイルをデプロイするためのターゲット Azure クラシック サブスクリプションを指定します。
Azure サブスクリプションの azureSubscription
-
入力エイリアス: ConnectedServiceNameARM
。
string
.
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 Serverの ServerName
-
string
.
AuthenticationType = server || AuthenticationType = aadAuthenticationPassword || AuthenticationType = aadAuthenticationIntegrated || AuthenticationType = servicePrincipal
する場合に必要です。
Fabrikam.database.windows.net.placeholder,1433
や Fabrikam.database.windows.net.placeholder
など、Azure SQL Server の名前を指定します。
Azure SQL Serverの ServerName
-
string
.
AuthenticationType = server || AuthenticationType = aadAuthenticationPassword || AuthenticationType = aadAuthenticationIntegrated
する場合に必要です。
Fabrikam.database.windows.net.placeholder,1433
や Fabrikam.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
-
展開の種類
入力エイリアス: TaskNameSelector
。
string
. 必須。 使用できる値: DacpacTask
(SQL DACPAC ファイル)、SqlTask
(SQL スクリプト ファイル)、InlineSqlTask
(インライン SQL スクリプト)。 既定値: DacpacTask
.
DeploymentAction
-
アクションの
string
.
TaskNameSelector = DacpacTask
する場合に必要です。 使用できる値: Publish
、Extract
、Export
、Import
、Script
、DriftReport
(ドリフト レポート)、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
. 必須。 使用できる値: AutoDetect
、IPAddressRange
。 既定値: 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
展開パッケージアクションが Extract
、Export
、Script
、DriftReport
、または DeployReport
されたときに生成される出力ファイルパス。
注釈
このタスクを使用して、DACPAC を使用して Azure SQL データベースをデプロイするか、SQLCMD を使用してスクリプトを実行します。
重要
このタスクは、Windows 環境でのみサポートされます。 Azure Active Directory (Azure AD) 統合認証を使用する場合は、プライベート エージェントを作成する必要があります。 Azure AD 統合認証は、ホストされているエージェントではサポートされていません。