azure - 如何获取 Azure 应用程序所在的组

标签 azure azure-active-directory

我可以使用此 API 获取 Azure 用户所在的直接组。我想要获取 Azure 应用程序所在的直接组。当我将应用程序添加到组中时,它会显示为服务原则。我可以看到有一个 API获取服务原则的直接memberOf 列表。但我没有看到获取应用程序组列表的 API。我错过了什么?

最佳答案

要获取应用程序所属的组列表memberOf,您可以通过包含<来使用以下查询强>microsoft.graph.group:

GET https://graph.microsoft.com/v1.0/servicePrincipals/<SP_objectID>/memberOf/microsoft.graph.group?$select=id,displayName,createdDateTime

我尝试在我的环境中重现相同的结果并得到以下结果:

我有一个名为 TestAppAzure AD 应用程序,并将其添加到如下组中:

enter image description here

同样,我也将该应用程序添加到 Group2Group3 中。

为了获取此应用程序是 memberOf组列表,我运行了以下查询并成功获得结果,如下所示:

GET https://graph.microsoft.com/v1.0/servicePrincipals/<SP_objectID>/memberOf/microsoft.graph.group?$select=id,displayName,createdDateTime

回应:

enter image description here

您还可以使用下面的查询,您将仅获得应用程序属于 memberOf组 ID 列表,如下所示:

POST https://graph.microsoft.com/v1.0/servicePrincipals/<SP_objectID>/getMemberGroups

{
    "securityEnabledOnly": true
}

回应:

enter image description here

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

相关文章:

azure - 在 Azure 中哪里集中 SSL 证书?

azure - 如何使用 Azure 市场中的 ARM 模板部署 Azure Function 应用程序(包括代码)

sql-server - Azure 数据工厂 - 将 Office 数据复制到 SQL Server

.net - 在 Azure 上生成失败 - 找不到 .NETFramework,Version=v4.7.2 的引用程序集

c# - 使用 Microsoft.AspNetCore.Authentication.AzureADB2C.UI 时如何覆盖/替换错误页面处理?

asp.net-mvc - 如果我的应用程序使用 Azure "Easy Auth",如何向 Microsoft Graph 进行身份验证

node.js - 监控运行到 Windows Azure 中的 Node.js 应用程序

azure - azure 云上的 IAM 和 Azure AD 有什么区别?

azure - 如何将我的 Azure AD 应用程序更改为 secret 客户端? (非公共(public)客户端)

authentication - Power Apps - 使用 Azure Active Directory 进行 OAUTH 2 身份验证