Service Principal object - How to return Synchronization object

machinevolution-4531 20 Reputation points
2024-06-07T06:10:51.2333333+00:00

I am trying to determine the amount of synchronization configured Service Principals may exist in a tenant.

When interacting with the Microsoft Graph however, I cannot filter on this nor can I seem to retrieve this data from the service principals API although the properties do exist.
example:

$sp = Get-MgServicePrincipal -ServicePrincipalID "{{insert SP GUID here}}" 
# returns empty data
$sp.Synchronization 
id -- 
$sp.Synchronization.GetType()   
IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     False    MicrosoftGraphSynchronization            System.Object  


$sp.Synchronization | fl *   
Id                   : 
Jobs                 : 
Secrets              : 
Templates            : 
AdditionalProperties : {}

Is there a way to filter synchronization configured service principal data from graph or is the only way to lookup all service principals and then check for a sync jobid? https://learn.microsoft.com/en-us/graph/api/synchronization-synchronization-list-jobs?view=graph-rest-1.0&tabs=http

Ultimately attempting to achieve something like below but for Entra Synchronization

Get-MgServicePrincipal -Filter "preferredSingleSignOnMode eq 'oidc'"
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,051 questions
0 comments No comments
{count} votes