Several API commands using the deviceManagement/managedDevices/ endpoint are failing, and I'm receiving a status code 400.

test box 5 Reputation points
2024-02-01T12:54:57.8266667+00:00

I'm running the following API requests:

  • curl -X POST https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/<device-id>/locateDevice -H "Accept: application/json" -H "Authorization: <XX_REPLACED>" -H "Content-Type: application/json"
  • curl -X POST https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/<device-id>/recoverPasscode -H "Accept: application/json" -H "Authorization: <XX_REPLACED>" -H "Content-Type: application/json"

Similarly for:

  • deviceManagement/managedDevices/<device-id>/disableLostMode
  • deviceManagement/managedDevices/<device-id>/shutDown

And I'm receiving the following error:

{
  "error": {
    "code": "BadRequest",
    "message": "{\r\n  \"_version\": 3,\r\n  \"Message\": \"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: <XXX> - Url: https://fef.amsub0202.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices('<device_id>')/microsoft.management.services.api.locateDevice?api-version=2023-07-04\",\r\n  \"CustomApiErrorPhrase\": \"\",\r\n  \"RetryAfter\": null,\r\n  \"ErrorSourceService\": \"\",\r\n  \"HttpHeaders\": \"{}\"\r\n}",
    "innerError": {
      "date": "2024-01-31T13:08:41",
      "request-id": "<XXX>",
      "client-request-id": "<XXX>"
    }
  }
}

In contrast, when I execute the deviceManagement/managedDevices/<device-id>/syncDevice API request on the same device_id, I see that it works as expected, and I receive a successful response with status code 204.

I have all the required permissions for these commands
User's image

Could someone explain why some commands are not working?

Microsoft Security | Microsoft Graph
{count} vote

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.