azuremicrosoft-graph-apimicrosoft-graph-sdks

Unable to filter the service principals by appOwnerOrganizationId property


I want to filter out all the service principals using odata filter query which belongs to Microsoft tenant. I am using MG powershell module.

Get-MgServicePrincipal -Filter 'appOwnerOrganizationId eq f8cdef31-a31e-4b4a-93e4-5f571e91255a' -ConsistencyLevel eventual

enter image description here


Solution

  • You are missing -CountVariable CountVar ($count query parameter)

    Get-MgServicePrincipal -Filter "appOwnerOrganizationId eq f8cdef31-a31e-4b4a-93e4-5f571e91255a" -CountVariable CountVar  -ConsistencyLevel eventual