azure - 如何获取 Microsoft Azure 应用程序的 appRoleAssignedTo?

标签 azure azure-active-directory azure-ad-graph-api azureportal azure-service-principal

我正在尝试为我的 Azure 租户获取 appRoleAssignedTo,现在假设如果该租户下有 10 个应用程序,我将必须通过传递所有 10 个应用程序的 servicePrincipal Id 来进行 10 个不同的调用。

GET/servicePrincipals/{id}/appRoleAssignedTo

有没有一种方法可以让我仅使用一个 API 调用即可获取相应 servicePrincipal 下的所有 appRoleAssignedTo。

或者,微软为servicePrincipal提供了增量调用,有没有一种方法可以让增量在appRoleAssignedTo发生更改时返回给我servicePrincipal(基本上将appRolesAssignedTo连接到servicePrincipal) P.S 我尝试过使用 $select 和 $expand 来做到这一点,但它不起作用。

https://learn.microsoft.com/en-us/graph/api/serviceprincipal-list-approleassignments?view=graph-rest-1.0&tabs=http

https://learn.microsoft.com/en-us/graph/api/serviceprincipal-delta?view=graph-rest-1.0&tabs=http

最佳答案

请尝试在 Graph Explorer 中使用 $expand=appRoleAssignedTo

https://graph.microsoft.com/v1.0/servicePrincipals?$expand=appRoleAssignedTo

如果您想同时使用 $select$expand,则需要 "id"

https://graph.microsoft.com/v1.0/servicePrincipals?$select=id,displayName&$expand=appRoleAssignedTo

响应如下所示:

{
    "value": [
    {
        "id": "xxxxxx",
        "displayName": "Managed Service",
        "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2a4b5a5a7845464f6b5959434d444f4e7e456a454e4b5e4b044945445e4f525e" rel="noreferrer noopener nofollow">[email protected]</a>": "https://graph.microsoft.com/v1.0/$metadata#servicePrincipals('xxxxx')/appRoleAssignedTo",
        "appRoleAssignedTo": []
    },
  ....
  ]
}

关于azure - 如何获取 Microsoft Azure 应用程序的 appRoleAssignedTo?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67683609/

相关文章:

c# - 来自 BlobItem 的 URL

带有 mod_auth_openidc 和 Azure AD 的 Apache 无法正常工作

c# - Azure AD : Property 'mail' is read-only and cannot be set

azure - 自动授予 Azure Active Directory Web 应用程序权限

azure - AADSTS50012 : Invalid client secret is provided when moving from a Test App to Production

SQL Server : How to create hierarchy combinations from a table

c# - 为什么 SendBatch 从事件中心 .NET Standard 客户端中删除?有替代品吗?

azure - 如何在 Azure Functions 中使用多种身份验证方案

Azure Microsoft Graph API - 订阅 - 验证请求失败

sql-server - 在哪里可以找到 SQL Server 和 SQL Azure 之间的差异?