【问题标题】:Obtaining a users Application access from Azure Graph API从 Azure Graph API 获取用户应用程序访问权限
【发布时间】:2015-01-25 10:34:34
【问题描述】:

我正在使用 GraphHelper 库 (http://www.nuget.org/packages/Microsoft.Azure.ActiveDirectory.GraphClient) 从 Azure AD 获取用户详细信息。但是,我正在努力获取 approles 信息,它返回:

资源“appRoleAssignments”不存在或其查询的引用属性对象之一不存在。

代码:

   public static async Task<List<AzureAppRole>> GetApplications(User user)
    {

        var appRoles = new List<AzureAppRole>();

        var userFetcher = user as IUserFetcher;
        IPagedCollection<IAppRoleAssignment> rawObjects = await userFetcher.AppRoleAssignments.ExecuteAsync();

        do
        {
            List<IAppRoleAssignment> directoryObjects = rawObjects.CurrentPage.ToList();
            foreach (IAppRoleAssignment dobject in directoryObjects)
            {
                if (dobject is AppRole)
                {
                    var u = (AppRole)dobject;
                    appRoles.Add(new AzureAppRole
                    {
                        DisplayName = u.DisplayName,
                        ObjectId = u.Value

                    });
                }
            }
            rawObjects = rawObjects.GetNextPageAsync().Result;
        } while (rawObjects != null && rawObjects.MorePagesAvailable);

        return appRoles;

    }

编辑:

查看原始 API 调用,我可以看到它正在调用以下内容,当使用 GraphExplorer 进行查询时会导致错误:

https://graph.windows.net/tenant/directoryObjects/objectid/appRoleAssignments?api-version=1.5

但是,以下查询会导致返回结果:

https://graph.windows.net/tenant/users/objectid/appRoleAssignments?api-version=1.5

这是库中的错误吗?

【问题讨论】:

  • 在 2.0.5 版本中修复。

标签: api azure office365 azure-active-directory


【解决方案1】:

感谢您报告错误。已在 Graph Client Library 2.0.5 中修复。

【讨论】:

    猜你喜欢
    • 2017-04-23
    • 2020-04-25
    • 1970-01-01
    • 1970-01-01
    • 2020-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多