微软图形API
自从您在问题中具体询问了 Microsoft Graph API 以来,我首先分享这些内容。
请注意列出服务主体 https://learn.microsoft.com/en-us/graph/api/serviceprincipal-list?view=graph-rest-betaapi 仅在 Beta 端点下可用。Beta 端点中的 API 可能会发生变化。 Microsoft 不建议您在生产应用程序中使用它们。我在下一节中分享了替代 API。
获取完整列表
https://graph.microsoft.com/beta/servicePrincipals
如果您需要仅筛选“应用程序类型”为“企业应用程序”(例如 Azure 门户允许的应用程序)的应用程序(下面的屏幕截图)
https://graph.microsoft.com/beta/servicePrincipals?$filter=tags/any(t:t eq 'WindowsAzureActiveDirectoryIntegratedApp')
Azure AD 图形 API
尽管在大多数情况下建议使用较新的 Microsoft Graph API,但在这种特殊情况下,Microsoft Graph API v1.0 尚不支持此功能,因此对于生产应用程序,您应该使用 Azure AD Graph API。在这里阅读更多信息Microsoft Graph 或 Azure AD Graph https://developer.microsoft.com/en-us/office/blogs/microsoft-graph-or-azure-ad-graph/
完整清单
https://graph.windows.net/myorganization/servicePrincipals
仅筛选出“应用程序类型”为“企业应用程序”(如 Azure 门户允许)的应用程序
https://graph.windows.net/myorganization/servicePrincipals?$filter=tags/any(t:t eq 'WindowsAzureActiveDirectoryIntegratedApp')
另外,还可以考虑使用其他查询参数,例如$top
只获取前 5 名并且$select
仅选择那些真正需要的字段。例子:
https://graph.microsoft.com/beta/servicePrincipals?$select=appid,appDisplayName&$top=5