英文:
Get homepage URL of applications user has access to from Microsoft Azure AD via Microsoft Graph API?
问题
我的目标是从Microsoft Azure AD图API获取用户有权限访问的应用程序及其主页URL。
使用https://learn.microsoft.com/en-us/graph/api/resources/approleassignment,我可以查看用户是哪些应用程序的用户(HTTP GET https://graph.microsoft.com/v1.0/me/appRoleAssignments)。但是结果数据中没有应用程序ID,所以我无法通过/applications/(appID)端点https://learn.microsoft.com/en-us/graph/api/application-get获取应用程序详细信息(HTTP GET https://graph.microsoft.com/v1.0/applications/)。
如何获取已登录用户是其用户的应用程序的应用程序详细信息?
我查询了https://learn.microsoft.com/en-us/graph/api/resources/approleassignment端点,然后尝试将其数据提供给应用程序端点,但来自角色分配端点的任何ID值都没有导致成功的请求,也没有与portal.azure.com应用程序页面中的数字匹配。
编辑:我现在看到resourceID与Azure门户中的对象ID匹配。但是,当我查询graph.microsoft.com/v1.0/applications / {ObjectID}时,出现以下错误:{ "code": "Request_ResourceNotFound", "message": "Resource '{ObjectID}' does not exist or one of its queried reference-property objects are not present.", "innerError": { "date": "2023-07-12T14:36:44", "request-id": "
英文:
My goal: get applications user has access to and their homepage URL's from Microsoft Azure AD graph API.
Using https://learn.microsoft.com/en-us/graph/api/resources/approleassignment I can see what applications the user is a user of (HTTP GET https://graph.microsoft.com/v1.0/me/appRoleAssignments). But the resulting data does not have the application ID, so I can't get the app details via the /applications/(appID) endpoint https://learn.microsoft.com/en-us/graph/api/application-get (HTTP GET https://graph.microsoft.com/v1.0/applications/).
How do I get the application details of applications the user (who is logged in) is a user of?
I queried the https://learn.microsoft.com/en-us/graph/api/resources/approleassignment endpoint then tried feeding it's data to the applications endpoint, and none of the ID values from the rolesassignment endpoint resulted in a successful request or matched with the numbers in the portal.azure.com page of the apps.
Edit: I see the resourceID matches the object ID in the azure portal now. But, when I do a query to graph.microsoft.com/v1.0/applications / {ObjectID} { "code": "Request_ResourceNotFound", "message": "Resource '{ObjectID}' does not exist or one of its queried reference-property objects are not present.", "innerError": { "date": "2023-07-12T14:36:44", "request-id": "<REMOVED>", "client-request-id": "<REMOVED>" } } I put the <removed> messages. Is my query right? Is this a permissions thing?
答案1
得分: 0
从应用程序角色分配中获取应用程序主页的URL将是一个多步骤的过程。
首先,从应用程序角色分配中获取resourceId
属性。这将是服务主体的ID。
然后,您需要使用获取服务主体
操作获取服务主体的详细信息。在服务主体详细信息中查找appId
属性。这是应用程序的ID。
一旦您获得了应用程序ID,然后您可以使用获取应用程序
获取应用程序的详细信息,然后从中获取主页URL。
英文:
To get the application home page URL from app role assignments, it's going to be a multi-step procedure.
First, get the resourceId
property from the app role assignment. This is going to be the service principal id.
Then you would need to get the details of the service principal using Get servicePrincipal
operation. Look for appId
property in the service principal details. This is the id of the application.
Once you have the application id, you would then get the details of the application using Get application
and from there you can get the home page URL.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论