onPremisesSecurityIdentifier is missing from graph api /devices endpoint

Bill Lam 20 Reputation points
2024-06-20T05:40:25.82+00:00

We are synchronizing Computer objects from on-prem Active Directory to Entra ID via Entra ID Connect. We want to correlate the information between on-prem Computer objects and Entra ID devices.

From my understanding, it can be done by matching up the onPremisesSecurityIdentifier attribute from Entra ID devices with the objectGUID from Active Directory. But when I tried to list the devices and their onPremisesSecurityIdentifier from Graph API, the onPremisesSecurityIdentifier is always missing.

I am calling the following endpoint from MS Graph API:

Invoke-MgGraphRequest -uri "https://graph.microsoft.com/beta/devices?$select=onPremisesSecurityIdentifier" -Method GET -OutputType Json

The following is an excerpt of one of the object I received. No onPremisesSecurityIdentifier is returned.

{

"enrollmentType": "OnPremiseCoManaged",

"managementType": "MDM",

"onPremisesLastSyncDateTime": "2024-06-19T01:31:57Z",

"onPremisesSyncEnabled": true,

"operatingSystem": "Windows",

"operatingSystemVersion": "10.0.19045.4412",  

...

}

See if anything else is missing. Thank you.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,166 questions
Microsoft System Center
Microsoft System Center
A suite of Microsoft systems management products that offer solutions for managing datacenter resources, private clouds, and client devices.
889 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,627 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,253 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 98,766 Reputation points MVP
    2024-06-20T06:47:50.3033333+00:00

    The onPremisesSecurityIdentifier property is not returned by default, you have to specifically request it, as you have tried above. The problem with your example is that PowerShell treats the "$" character to designate variables, and in this case it's effectively looking for $select variable, which does not exist. In turn, you get the "standard" output, without the requested property. To work around this, you need to escape the $ char or use single quotes instead. Any of these would do:

    $res = Invoke-MgGraphRequest -uri "https://graph.microsoft.com/v1.0/devices?`$select=id,onPremisesSecurityIdentifier"
    $res = Invoke-MgGraphRequest -uri 'https://graph.microsoft.com/v1.0/devices?$select=id,onPremisesSecurityIdentifier'
    $res.value
    

0 additional answers

Sort by: Most helpful