Use DevTools to find the Graph API requests made by MEM
If you’re looking into automating certain Microsoft Endpoint Manager functions, or just pulling data out of the service programmatically, you’ve likely spent some time looking at the Corporate Management Graph Docs. These Docs identify all of the various methods you can perform against Intune & MEM using the Graph API. For example, managedDevice includes the ability to wipe devices, get information on the device object, run Defender scans; basically anything you can see in the console when looking at a Device record:
But what if you’re looking at something in the MEM console, and you don’t know exactly what the name of the Graph resource is? For that, we can use your browser’s Developer Tools.
Go the endpoint.microsoft.com, right click anywhere on the screen, and select Inspect:
This launches DevTools. Depending on your settings it may launch pinned to the side, on the bottom, or in another window, but all of the various tools will be there. Select the Network tab. In the network tab, we are tracking all of the commands we made as we move through the console. So now if we click on Devices in the MEM console…
We’ll see dozens of requests were made in the service for pulling information. The Devices pane contains a lot of aggregate information, like enrolled devices and enrollment failures. If we scroll down through the DevTools list we’ll find one of the names looks familiar, managedDeviceOverview. And if we click on that name in DevTools, we’ll see the request that was made against Graph!
So now we know one of the many things we were requesting from Graph by clicking the Devices pane:
Request URL: https://graph.microsoft.com/beta/deviceManagement/managedDeviceOverview
Request Method: GET
Let’s look at the Network pane in DevTools after we click into a specific device. In the console, I’ll navigate to one of my enrolled devices:
Then with the Network pane in DevTools, we’ll see a lot of managedDevices requests were made:
Many of which include the device ID, because we’re querying a specific object:
And if we want, we can take that exact Request URL from the Network pane, and throw it into Graph Explorer to see that we pull the exact same information about the device:
And we do! With that URL handy now we can request that data from anywhere! In PowerShell for example, we use the Invoke-MSGraphRequest commandlet with the same URL to also pull the data:
Once we have something in PowerShell, the sky’s the limit. If you have creative ways to use MEM data in Graph, let me know. Happy requesting! 📦