Issues using /deviceManagement/managedDevices/{managedDevice-id}/cleanWindowsDevice endpoint

Ylan Muller 20 Reputation points
2025-05-01T22:21:10.1033333+00:00

I am attempting to run a call to https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/{managedDevice-id}/cleanWindowsDevice

utilizing a deviceId that I am retrieving from this endpoint /users/{userId}/registeredDevices, which means it is in Intune.

When I try to run the call through the Microsoft API Explorer, I always get "Resource Not Found," even with the proper scopes authed and using this as a reference: https://learn.microsoft.com/en-us/graph/api/intune-devices-manageddevice-cleanwindowsdevice?view=graph-rest-1.0&tabs=http

User's image

Screenshot 2025-05-01 at 3.19.33 PM

I am not clear on what this error means. Has anyone successfully called this endpoint? What am I missing?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,541 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 117.8K Reputation points MVP
    2025-05-02T08:05:26.32+00:00

    utilizing a deviceId that I am retrieving from this endpoint /users/{userId}/registeredDevices, which means it is in Intune.

    Your assumption above is incorrect. Even though the device object does exist in Intune, the deviceId value will differ between the two directories and you cannot use it directly. You can however filter on it, by leveraging the azureADDeviceId query:

    GET https://graph.microsoft.com/beta/deviceManagement/managedDevices?$filter=azureADDeviceId eq 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx'
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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