本投稿はAzure Advent Calendar 2019の7日目の投稿になります。
Logic AppsにVideo Indexerコネクタが増えていたので、実際に触ってみました。
まずはLogic Appを作成します。

現在使えるLogic Appsコネクタ
現時点ではトリガーは用意されていませんが、アクションはそれなりに用意されています。


コネクター一覧はMicrosoft Docsにまとまっています。
参考 Video Indexer (V2) (Preview)Microsoft DocsDropboxに動画ファイルをアップロードしたらVideo Indexerに投げ込む
Dropboxの特定のディレクトリにmp4ファイルをアップロードしたらVideo Indexerに投げ込むという事も出来ます。
APIキーの取得
事前にVideo Indexer側からAPI Keyを取得する必要があります。
まず、Video Indexer Developer Portal にログインし、右上の自分の名前の所ををクリックし、”PROFILE”をクリックします。


次に”Primary key”の”Show”ボタンをクリックしてキーを表示させます。

Logic Appデザイナーで組み上げる
実際にLogic Appで動かす処理はLogic Appデザイナーで組み上げていきます。
今回は、Dropboxの指定したディレクトリに拡張子が.mp4なファイルが作成されたときにVideo Indexerにアップロード・インデキシングされるという内容です。
実際のフローはこんな感じ。

今回はサクッと作ったので、条件はそこまで厳しく設定していません。
Video Indexerにアップロードする際はAccess Tokenが必要になるので事前に別のアクション(Get Account Access Token)で取得します。
ここで取得したAccess Tokenを”Upload video and index”アクションに食わせることで、アップロード出来ます。
また、うまくいったらメール通知もしたいので、Gmailコネクタを使って自分のメールアドレスに向けて結果を送信します。

Upload video and indexの所ですが、”Body”に「ファイルコンテンツ」を入れるのが正解です。

結果
こんな感じに実行出来ました。


こういうのって普通に実装すると地味に工数かかっちゃうんですけど、Logic Appsを駆使すると短時間に作れます。自分で手作業していて効率悪いと思った作業はこうやってLogic Appsを使うといいかなって思っています。