How to get Intune Device ID with Graph

Copper Contributor

Hi all

I'm looking for a solution on how to get a Intune Device ID of an enrolled device.

 

What I need:

Send some commands to manage devices using Graph, based on the Owner or PrimaryUser of a given device, for example:

POST https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/{managedDeviceId}/rebootNow

 

This call would reboot the device. Notice that I need to have the managedDeviceId, which is the "Intune Device ID"

 

The challenge is, how to get this Intune Device ID based on the device PrimaryUser or Device Owner using Graph?

 

I've already tried the GET https://graph.microsoft.com/v1.0/{user}/ownedDevices - it doesn't help me because It will retrieve the the Object and Device ID not the Intune Device ID.

 

Any suggestion is appreciated 

 

Regards

1 Reply
You can do it the other way around - once you have the DeviceId from Azure AD, you can filter by its value via the azureADDeviceId property on the managedDevice object:

GET https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$filter=azureADDeviceId eq '05ab7c00-1111-2222-3333-ef539bf2a27b'