〽️

Logic Apps で Microsoft Graph API を操作

に公開

はじめに

一部の Microsoft Graph API は Logic Apps でコネクタが準備されていますが、大部分は HTTP コネクタで実行する必要がありますので、その方法を残しておきます。

設定方法

まず、Logic Apps のマネージド ID 有効化して、下記記事を参考に Microsoft Graph API のアクセス許可を構成します。

https://zenn.dev/microsoft/articles/ae0bf38eebfa48

HTTP コネクタにおいてマネージド ID の認証を有効にします。


以下のように URI を指定します。今回は GET なので Body は空にしています。


Logic Apps のコード ビュー サンプルはこちらです。

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "contentVersion": "1.0.0.0",
        "triggers": {
            "When_a_HTTP_request_is_received": {
                "type": "Request",
                "kind": "Http"
            }
        },
        "actions": {
            "HTTP_-_Graph_API": {
                "runAfter": {},
                "type": "Http",
                "inputs": {
                    "uri": "https://graph.microsoft.com/v1.0/users",
                    "method": "GET",
                    "authentication": {
                        "type": "ManagedServiceIdentity",
                        "audience": "https://graph.microsoft.com/"
                    }
                },
                "runtimeConfiguration": {
                    "contentTransfer": {
                        "transferMode": "Chunked"
                    }
                }
            }
        },
        "outputs": {},
        "parameters": {
            "$connections": {
                "type": "Object",
                "defaultValue": {}
            }
        }
    },
    "parameters": {
        "$connections": {
            "type": "Object",
            "value": {}
        }
    }
}

実行結果

以下のように Microsoft Graph API が実行できます。

Microsoft (有志)

Discussion