I am trying to filter out EntraID applications which has at least one owner assigned.
As per the Microsoft documentation, Owners supports filter based on count.
Directory objects that are owners of the application. Read-only. Nullable. Supports $expand, $filter (/$count eq 0, /$count ne 0, /$count eq 1, /$count ne 1), and $select nested in $expand.
Here is the query I am trying. Appreciate any help on this.
Cheers !
Filtering will work, but you need to add the request header ConsistencyLevel
with the value eventual
and the query must contain $count=true
parameter.
Applications with at least one owner
GET https://graph.microsoft.com/v1.0/applications?$filter=owners/$count ne 0&$count=true&$select=id,displayName
ConsistencyLevel:eventual
When filtering applications by the number of owners, you can't expand owners
(expand and filter on owners is not supported in one query)
If you are using PowerShell, you need to escape $
character
Invoke-WebRequest -UseBasicParsing -Headers $TargetEnvironments.Header -Uri "graph.microsoft.com/v1.0/applications?`$filter=owners/`$count ne 0&`$count=true&`$select=id,displayName"