Microsoft Graph API
我首先分享这些,因为您在问题中专门询问了 Microsoft Graph API。
请注意List ServicePrincipals api 仅在 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 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