SOLVED

How to get objectID from device name

Copper Contributor

I've been working on a project that uses a custom connector in Power Automate to send API calls to Power Graph to get data on users and devices in Microsoft Intune.  The Power Automate custom connector is working well, and it can get data on a user or device if I supply an objectID (or in the case of a user, I can also supply a UPN).

For example, to get the information on a user, it's:

https://graph.microsoft.com/v1.0/users/{objectID}

For a device, it's a little more difficult because the objectID has to be the one from AzureAD, not from Intune.  That query is:

https://graph.microsoft.com/v1.0/devices/{objectID} 

However... I want to build-out a solution that can take a device object NAME (not the objectID from AAD) to determine what the objectID is (without having to look up the device/computer in the AAD portal).  Once I have that objectID, I can use existing functionality in my custom connector to get details about the device object.  So far, however, all of the API queries I can find require the objectID as input.  Not very useful when you need to know the objectID of LAPTOP.JOHNSMITH.  Does anyone know if there is a way to get the objectID via Graph (from AAD)?

2 Replies
best response confirmed by bob-lamaster (Copper Contributor)
Solution
I believe I've found it. In the Power Automate custom connector, I can use the query https://graph.microsoft.com/v1.0/devices/?$filter
This will create a parameter when the API request is submitted that I can specify as
displayName eq 'LAPTOP.JOHNSMITH'

How to get objectID from device name I've been working on a project that uses a custom connector in Power Automate to send API calls to Power Graph to get data on users and devices in Microsoft Intune. The Power Automate custom connector is working well, and it can get data on a user or device if I supply an objectID (or in the case of a user, I can also supply a UPN). For example, to get the information on a user, it's: https://graph.microsoft.com/v1.0/users/{objectID} For a device, it's a little more difficult because the objectID has to be the one from AzureAD, not from Intune. That query is: https://graph.microsoft.com/v1.0/devices/{objectID/apkmod} However... I want to build-out a solution that can take a device object NAME (not the objectID from AAD) to determine what the objectID is (without having to look up the device/computer in the AAD portal). Once I have that objectID, I can use existing functionality in my custom connector to get details about the device object. So far, however, all of the API queries I can find require the objectID as input. Not very useful when you need to know the objectID of LAPTOP.JOHNSMITH. Does anyone know if there is a way to get the objectID via Graph (from AAD)?

1 best response

Accepted Solutions
best response confirmed by bob-lamaster (Copper Contributor)
Solution
I believe I've found it. In the Power Automate custom connector, I can use the query https://graph.microsoft.com/v1.0/devices/?$filter
This will create a parameter when the API request is submitted that I can specify as
displayName eq 'LAPTOP.JOHNSMITH'

View solution in original post