0
votes

I am using the GraphHelper Library (http://www.nuget.org/packages/Microsoft.Azure.ActiveDirectory.GraphClient) to obtain user details from Azure AD. However, I am strugging to get the approles information, it returns:

Resource 'appRoleAssignments' does not exist or one of its queried reference-property objects are not present.

Code:

   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;

    }

EDIT:

Looking at the raw API calls I can see it is calling the following which, when queried using GraphExplorer results in an error:

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

However, the following query results in the results being returned:

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

Is this a bug in the library?

1
Fixed in version 2.0.5.Jamie

1 Answers

0
votes

Thanks for reporting the bug. Fixed in Graph Client Library 2.0.5.