microsoftgraph / microsoftgraph/msgraph-beta-sdk-dotnet

Individual request to the Managed device sometimes returns wrong user information.

Open
#871 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
Dominant language
C#
Stars
112
Forks
37
Avg merge
14h 57m
Merged PRs (30d)
3

Description

Describe the bug

Managed Intune device resource has some user information fields: userId, userPrincipalName, userDisplayName.

Request to the devices list
returns a correct actual Primary User data (at least now, about 1-2 years ago it was not accurate for example after primary user changing)

Request to an individual device returns a wrong Primary User information for several devices (but I have actual PU data for these devices in the List response).
Tested that after changing PU information is synchronized correctly. But, for some OLD-EXISTENT devices where PU was NOT UPDATED information is wrong.

Can this issue be fixed please?

P.S. I know that correct primary user data can be loaded from another query
GET /beta/deviceManagement/managedDevices/{managedDeviceId}/users
But it would be nice if Individual request will return a correct data, like the list request does now.

And we avoid using additional requests for each device / primary user due to query limits, it is very inconvenient and need much time when there is a large amount of devices.

Expected behavior

Request to an Individual managed device to return a correct Primary User data: userId, userPrincipalName, userDisplayName.

How to reproduce

Request to some old-existend managed device:
/deviceManagement/managedDevices/{managedDeviceId}?$select=userId,userPrincipalName,userDisplayName
Compare user data with the response of
/deviceManagement/managedDevices/{managedDeviceId}/users?$top=1&select=id,userPrincipalName,displayName

SDK Version

5.60.0

Latest version known to work for scenario above?

none

Known Workarounds

No response

Debug output
Click to expand log
Other information

Problematic device: graph api response examples

Get device entity response - WRONG user data

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#deviceManagement/managedDevices(userId,userDisplayName,userPrincipalName,id)/$entity",
    "userId": "00000000-0000-0000-0000-000000000000",
    "userDisplayName": null,
    "userPrincipalName": null,
    "id": "726f2e97-****"
}

Get devices list response - correct user data

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#deviceManagement/managedDevices(userId,userDisplayName,userPrincipalName)",
    "@odata.count": 1,
    "value": [
        {
            "userId": "98013b47-****",
            "userDisplayName": "Cpc User",
            "userPrincipalName": "CpcUser@****",
            "id": "726f2e97-****"
        }
    ]
}

Get device users response - correct user data

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#users(id,userPrincipalName,displayName)",
    "value": [
        {
            "id": "98013b47-****",
            "userPrincipalName": "CpcUser@****",
            "displayName": "Cpc User"
        }
    ]
}

ANOTHER device: Get managed device returns conflicting data!

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#deviceManagement/managedDevices(userId,userDisplayName,userPrincipalName,id)/$entity",
    "userId": "98013b47-****",
    "userDisplayName": null,
    "userPrincipalName": null,
    "id": "2dabd86f-****"
}

Graph explorer screen:
Untitled

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the individual managed-device request with the managed-device list response and the /deviceManagement/managedDevices/{managedDeviceId}/users request for an old device. Confirm whether the inconsistency is in the beta API or SDK behavior; done means the individual response returns the same correct userId, userPrincipalName, and userDisplayName without an extra request.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.