0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Azure】DataFactoryのアクティビティ失敗時のメール通知

Last updated at Posted at 2023-05-12

はじめに

こんにちは。株式会社ZEALの@ey___00129です。

Azure DataFactoryのアクティビティが失敗した際のメール通知について
Azure Logic Appsを使って実装していきたいと思います。

利用するAzureリソースは以下
・DataFactory
・Azure Logic Apps

所要時間:30分程で実装可能

Logic Appsの作成

まずは、Logic Appsのリソースを作成していきます。

image.png

ロジック アプリ デザイナーにて作成フローは以下の通り。

image.png

HTTP POSTのURLは、あとでDataFctory上で使います。
JOSNスキーマには、DataFactoryから受け取るデータのスキーマを定義します。

image.png

今回は、以下を対象にJSONを記載。
・対象のDataFactory名
・エラーメッセージ
・パイプライン名

{
    "properties": {
        "dataFactoryName": {
            "type": "string"
        },
        "message": {
            "type": "string"
        },
        "pipelineName": {
            "type": "string"
        }
    },
    "type": "object"
}

メール送信部分で、メールの本文、宛先の設定、上記で受信したデータを利用できます。

image.png

他にも、差出人や重要度をオプションとして追加できそうでした。

image.png

ここまでで、Logic Appsの設定は完了です。
そのまま実行してメールを送れるか試すことも可能です。

DataFactoryのアクティビティ設定

ここからは、DataFactoryのアクティビティ設定となりますが、
先ほど作成したLogic AppsのURLが必要となります。

まず、エラーを検知したいアクティビティからエラーの赤線を引っ張り
Webアクティビティに繋げます。

image.png

Webアクティビティの詳細は、以下。
URL部分にLogic AppsのURLを貼り付けます。

image.png

Bodyは、Logic Appsに送信するJSONを記載します。

{"message":"@{activity('Insert').error.message}","dataFactoryName":"@{pipeline().DataFactory}","pipelineName":"@{pipeline().Pipeline}"}

DataFactory実行確認

作成したパイプラインを実際に動かしてみました。

image.png

エラー通知のメールが飛んできました!!

image.png

以上で、完了です。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?