
こんにちは、あおいです。
さて、Power AutomateでDataverseにバッチ処理の実行をしたいので、以下の記事を見つけました。
自動フローによる Common Data Service でのバッチ操作のサポート
しかし、残念ながら[バッチ]スコープは現在利用可能なアクションとしては存在していませんでした。
また、現時点で利用可能な類似のアクションとして、Dataverse コネクタの[変更セット要求を実行する]アクションがありますが、本アクションのスコープ内には Dataverse コネクタのアクション以外を組み込むことができないため、現時点では、Apply to each などの繰り返し処理をバッチ処理として実行することができません。

上記アクションの詳細につきましては、以下の公開情報を参考にしてみてください。
フローを使用して、Dataverseの変更セット要求を実行します
※以下、一部抜粋いたします。

また、上記のほかに Power Automate を使用してバッチ処理を実行する方法がないか調査しましたが、バッチ処理を目的として用意されているアクションは上記アクション以外にはありませんでした。なお、代替案として、Web API を利用する方法であれば、Power Automateでバッチ処理が実現可能です。
そこで、今回はPower AutomateでWeb APIを利用したバッチ処理の実行方法について紹介したいと思います。
基本的に、以下の公開情報を参考にバッチリクエストを作成することで、バッチ処理の実行が可能です。
Web API を使用したバッチ処理の実行(Microsoft Dataverse) - Power Apps | Microsoft Docs
[HTTP with Azure AD]コネクタの[HTTP要求を呼び出します]アクションを選択します。
最初に接続を作成する必要があるので、[基本リソースURL][Azure ADリソースURL]の両方にリクエスト先Dataverseの環境URLを設定します。

要求の本文では、POSTリクエストでレコードの新規作成をします。
--batch_AAA123
Content-Type: multipart/mixed;boundary=changeset_BBB456
--changeset_BBB456
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-ID:1
POST https://<環境URL>/api/data/v9.1/<テーブル名の複数形> HTTP/1.1
Content-Type: application/json;type=entry
{
"ColumnName":Value1
}
--changeset_BBB456
Content-Type:application/http
Content-Transfer-Encoding:binary
Content-ID:2
POST https://<環境URL>/api/data/v9.1/<テーブル名の複数形> HTTP/1.1
Content-Type: application/json;type=entry
{
"ColumnName":Value2
}
--changeset_BBB456--
--batch_AAA123--
上記を参考に要求の本文を作成します。


なお、HTTPリクエストの作成方法については下記公開情報を参考にしてみてください。
HTTP要求の作成とエラーの処理(Microsoft Dataverse) - Power Apps | Microsoft Docs
試しにフロー実行をして確認すると、正常にバッチ処理が実行されています!

今回はPower AutomateでWeb APIを利用したバッチ処理の実行方法について紹介させていただきました。本記事が少しでも読者の皆様のお役に立てれば幸いです。