適用対象: Azure Data Factory
Azure Synapse Analytics
ヒント
企業向けのオールインワン分析ソリューション、Microsoft Fabric の Data Factory をお試しください。 Microsoft Fabric は、データ移動からデータ サイエンス、リアルタイム分析、ビジネス インテリジェンス、レポートまで、あらゆるものをカバーしています。 無料で新しい試用版を開始する方法について説明します。
Note
ワークフロー オーケストレーション マネージャーは Apache Airflow を利用しています。
この記事では、Azure Data Factory ワークフロー オーケストレーション マネージャー統合ランタイムの REST API について説明します。
Note
Azure Data Factory 用のワークフロー オーケストレーション マネージャーは、オープンソースの Apache Airflow アプリケーションに依存しています。 Airflow のドキュメントとその他のチュートリアルについては、Apache Airflow のドキュメントまたはコミュニティの Web ページをご覧ください。
新規環境の作成
メソッド: PUT
URL:
https://management.azure.com/subscriptions/<subscriptionid>/resourcegroups/<resourceGroupName>/providers/Microsoft.DataFactory/factories/<datafactoryName>/integrationruntimes/<airflowEnvName>?api-version=2018-06-01
URI パラメーター:
名前 / 必須 タイプ 説明 サブスクリプション ID path True string サブスクリプション識別子 ResourceGroup 名 path True string リソース グループ名 (正規表現パターン: ^[-\w\._\(\)]+$
)dataFactoryName path True string Azure Data Factory インスタンスの名前 (正規表現パターン: ^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$
airflowEnvName path True string ワークフロー オーケストレーション マネージャー環境の名前 API バージョン query ○ string API のバージョン 要求本文 (Airflow 構成):
名前 種類 説明 name string Airflow 環境の名前 properties propertyType 環境の構成プロパティ プロパティの型:
名前 種類 説明 Type string リソースの種類 (このシナリオでは Airflow) typeProperties typeProperty エアフロー Type プロパティ:
名前 種類 説明 computeProperties computeProperty 環境に使われたコンピューティングの種類の構成 airflowProperties airflowProperty 環境の Airflow プロパティの構成 コンピューティング プロパティ:
名前 種類 Description location string Airflow 統合ランタイムの場所は、既定でデータ ファクトリのリージョンに設定されます。 別のリージョンに統合ランタイムを作成するには、必要なリージョンに新しいデータ ファクトリを作成します。 computeSize string ご利用の Airflow 環境を実行する計算ノードのサイズ。 たとえば、Large または Small です。 最初に 3 つのノードが割り当てられます。 extraNodes integer 追加ノードごとに、さらに 3 つのワーカーが追加されます。 Airflow プロパティ:
名前 種類 説明 airflowVersion string エアフローの現在のバージョン。 たとえば、2.4.3 です。 airflowRequirements Array<string> 使用する Python ライブラリ。 たとえば、["flask-bcrypy=0.7.1"] です。 コンマ区切りのリストを指定できます。 airflowEnvironmentVariables オブジェクト (キーと値のペア) 使用する環境変数。 たとえば、{ "SAMPLE_ENV_NAME": "test" } です。 gitSyncProperties gitSyncProperty Git 構成プロパティ。 enableAADIntegration boolean Microsoft Entra ID がエアフローにログインできるようにします。 userName 文字列または null 値 Basic 認証のユーザー名。 password 文字列または null 値 Basic 認証のパスワード。 Git 同期プロパティ:
名前 種類 説明 gitServiceType string 目的のリポジトリが配置されている Git サービス。 値は、GitHub、ADO、GitLab、または Bitbucket です。 gitCredentialType string Git 資格情報の種類。 値は PAT (個人用アクセス トークンの場合) となしです。 レポジトリ string リポジトリ リンク。 分岐 string リポジトリで使うブランチ。 username string GitHub ユーザー名。 資格情報 string PAT の値。 応答:
名前 状態コード 型 説明 同意 200 ファクトリ OK 権限がありません 401 クラウド エラー エラーの詳細を含む配列
DAG のインポート
メソッド: POST
URL:
https://management.azure.com/subscriptions/<subscriptionid>/resourcegroups/<resourceGroupName>/providers/Microsoft.DataFactory/factories/<dataFactoryName>/airflow/sync?api-version=2018-06-01
要求本文:
名前 種類 説明 IntegrationRuntimeName string エアフロー環境の名前。 LinkedServiceName string インポートする DAG が配置されている Azure Blob Storage アカウント名。 StorageFolderPath string DAG を含む Azure Blob Storage 内のフォルダーへのパス。 Overwrite boolean 既存の DAG を上書きします (Default=True)。 CopyFolderStructure boolean フォルダー構造をコピーするかどうかを制御します。 AddRequirementsFromFile boolean DAG ファイルから要件を追加する 応答:
名前 状態コード 型 説明 同意 200 ファクトリ OK 権限がありません 401 クラウド エラー エラーの詳細を含む配列
例
次の例を確認してください。
REST API を使用して新しい環境を作成する
要求のサンプル:
HTTP
PUT https://management.azure.com/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/abnarain-rg/providers/Microsoft.DataFactory/factories/ambika-df/integrationruntimes/sample-2?api-version=2018-06-01
サンプル本文:
{
"name": "sample-2",
"properties": {
"type": "Airflow",
"typeProperties": {
"computeProperties": {
"location": "East US",
"computeSize": "Large",
"extraNodes": 0
},
"airflowProperties": {
"airflowVersion": "2.4.3",
"airflowEnvironmentVariables": {
"AIRFLOW__TEST__TEST": "test"
},
"airflowRequirements": [
"apache-airflow-providers-microsoft-azure"
],
"enableAADIntegration": true,
"userName": null,
"password": null,
"airflowEntityReferences": []
}
}
}
}
サンプル応答
Status code: 200 OK
応答本文:
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/your-rg/providers/Microsoft.DataFactory/factories/your-df/integrationruntimes/sample-2",
"name": "sample-2",
"type": "Microsoft.DataFactory/factories/integrationruntimes",
"properties": {
"type": "Airflow",
"typeProperties": {
"computeProperties": {
"location": "East US",
"computeSize": "Large",
"extraNodes": 0
},
"airflowProperties": {
"airflowVersion": "2.4.3",
"pythonVersion": "3.8",
"airflowEnvironmentVariables": {
"AIRFLOW__TEST__TEST": "test"
},
"airflowWebUrl": "https://e57f7409041692.eastus.airflow.svc.datafactory.azure.com/login/",
"airflowRequirements": [
"apache-airflow-providers-microsoft-azure"
],
"airflowEntityReferences": [],
"packageProviderPath": "plugins",
"enableAADIntegration": true,
"enableTriggers": false
}
},
"state": "Initial"
},
"etag": "3402279e-0000-0100-0000-64ecb1cb0000"
}
DAG のインポート
要求のサンプル:
HTTP
POST https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/your-rg/providers/Microsoft.DataFactory/factories/your-df/airflow/sync?api-version=2018-06-01
サンプル本文:
{
"IntegrationRuntimeName": "sample-2",
"LinkedServiceName": "AzureBlobStorage1",
"StorageFolderPath": "your-container/airflow",
"CopyFolderStructure": true,
"Overwrite": true,
"AddRequirementsFromFile": true
}
サンプル応答
Status Code: 202