microsoft-graph-apiintunemicrosoft-graph-intunedevice-managementgraph-explorer

Getting 404 when requesting physicalMemoryInBytes using Graph API


The response I currently receive from Graph Explorer with the following query: https://graph.microsoft.com/beta/deviceManagement/managedDevices/11111111-1111-1111-1111-111111111111

{
    "error": {
        "code": "ResourceNotFound",
        "message": "{  \"_version\": 3,  \"Message\": \"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 0b8958f1-ec4b-20fb-40ed-e31e7d8044db - Url: https://fef.msua02.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices('5a9382a7-cfd4-4b93-b5f0-d8c8c69ed615')?api-version=2022-07-29\",  \"CustomApiErrorPhrase\": \"\",  \"RetryAfter\": null,  \"ErrorSourceService\": \"\",  \"HttpHeaders\": \"{}\"}",
        "innerError": {
            "date": "2023-06-25T17:19:30",
            "request-id": "b4a94f7b-6150-4b8d-8798-4d2ccb3449c2",
            "client-request-id": "0b8958f1-ec4b-20fb-40ed-e31e7d8044db"
        }
    }
}

What I've tried so far:

  1. Switching between v1.0 and beta: The error is given regardless of the endpoint version used
  2. Using a select statement: According to Microsoft docs - "Total Memory in Bytes. Default is 0. To retrieve actual values GET call needs to be made, with device id and included in select parameter. Supports: $select. Read-only. This property is read-only." Using a select still results in the same error..
  3. Tried opening a support request on Azure, the recommended actions was to consult SO.

I was expecting a number in bytes to be returned representing the RAM of the requested device. Instead I get this ResourceNotFoundError


Solution

  • I was querying using the Azure AD device ID and not the Intune device ID which both have the same format but are very much different things.

    As per API limitations though, it is still not possible to retrieve the RAM of all devices in a single query like so:

    https://graph.microsoft.com/beta/deviceManagement/managedDevices?$select=physicalMemoryInBytes,hardwareInformation
    

    By design, the above results in a list of devices with "physicalMemoryInBytes": 0.

    So the solution I have come up with is to run the following query on every individual device in the organization, using the Intune device ID. For future optimization, sending multiple batch requests might help improve performance.

    https://graph.microsoft.com/beta/deviceManagement/managedDevices/11111111-1111-1111-1111-111111111111?$select=physicalMemoryInBytes,hardwareInformation