Unable to filter the service principals by app owner organisation id

Gurkirat Singh 60 Reputation points
2025-06-17T18:12:31.5833333+00:00

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

Getting following errorUser's image

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 119.7K Reputation points MVP Volunteer Moderator
    2025-06-17T18:21:15.2266667+00:00

    You are missing the -CountVariable parameter ($count=true in the "raw" request). This works for me:

    Get-MgServicePrincipal -Filter 'appOwnerOrganizationId eq f8cdef31-a31e-4b4a-93e4-5f571e91255a' -ConsistencyLevel eventual -CountVariable count
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.