从Microsoft Azure AD通过Microsoft Graph API获取用户可以访问的应用程序主页URL?

huangapple go评论65阅读模式
英文:

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": "", "client-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.

huangapple
  • 本文由 发表于 2023年7月12日 21:59:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76671411.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定