代码之家  ›  专栏  ›  技术社区  ›  David Brunelle

使用图形资源管理器在Azure AD中访问用户与Power Automation

  •  0
  • David Brunelle  · 技术社区  · 2 年前

    我们有一个动态环境,我正在使用Powerautomation来调用Microsoft Graph,以便在Azure中更新一些用户。

    我使用调用HTTP请求在PowerAutomation中执行我的操作。

    在使用PowerAutomation之前,我总是使用图形资源管理器测试我的操作( https://developer.microsoft.com/en-us/graph/graph-explorer )以确保语法正确,并且我有权执行它。但是,我在某些操作上遇到了问题,这让我质疑我对Azure中权限的理解。

    例如,我尝试过这样做:

    https://graph.microsoft.com/v1.0/invitations (post)
    
    {
      "invitedUserEmailAddress": "4d86be94-b2d3-ed11-a7c7-0022483d0128",
      "inviteRedirectUrl": "http://365e.pro",
      "invitedUserDisplayName": "David Brunelle",
      "sendInvitationMessage": false,
      "invitedUserMessageInfo": {
        "customizedMessageBody": "Message"
      }
    }
    

    当我在图形资源管理器中这样做时,当我在Azure中检查用户时,我可以清楚地看到它是有效的。然而,当我在PowerAutomation中尝试时,我得到了这个

    {
      "error": {
        "code": "Unauthorized",
        "message": "Insufficient privileges to perform requested operation by the application '00000003-0000-0000-c000-000000000000'. ControllerName=MSGraphInviteAPI, ActionName=CreateInvite, URL absolute path=/api/7a272831-1132-49e5-aa92-2c4f6ad1ff1d/invites",
        "innerError": {
          "request-id": "cfe808e8-8185-4414-bed6-7b1b6a785a00",
          "date": "2023-04-06T20:07:38",
          "client-request-id": "cfe808e8-8185-4414-bed6-7b1b6a785a00"
        }
      }
    }
    

    如果我尝试一个简单的get动作,我看没有问题。 通常,当我遇到访问问题时,我可以在图形资源管理器中看到它,然后我可以添加或删除访问权限,再次测试它,当我做对了,它也可以在PowerAutomation中工作。

    我在这里错过了什么???为什么Graph Explorer可以工作,但PowerAutomation不能与同一用户一起工作。

    以下是我在Power Automation中使用的内容

    enter image description here

    在这张图片中,我输入了与图形资源管理器相同的凭据。 enter image description here

    当我尝试使用相同凭据的此操作时,它工作正常。 enter image description here

    0 回复  |  直到 2 年前