Intune Graph API: filtering on a key in an Object in a JSON array

342 Views Asked by At

Using Graph API Explorer, the following command produces a list of macOS VPP apps that are assigned as "required" to any Group in my Intune tenant:

https://graph.microsoft.com/beta/deviceAppManagement/mobileApps?$filter= isof('microsoft.graph.macOsVppApp') and isAssigned eq true&$expand=assignments($select=intent,target;$filter=intent eq 'required')

However, I would also like to be able filter on specific groups. Here's a snippet of the output of the above command:

screenshot

I'm probably missing something quite simple, but I haven't been able to figure out how to filter my Graph query based on the "groupId" field. This command:

https://graph.microsoft.com/beta/deviceAppManagement/mobileApps?$filter= isof('microsoft.graph.macOsVppApp') and isAssigned eq true&$expand=assignments($select=intent,target;$filter=target.groupId eq '14etcblahblah')

Yields the following error:

"error": {
        "code": "BadRequest",
        "message": "Parsing OData Select and Expand failed: The child type 'target.groupId' in a cast was not an entity type. Casts can only be performed on entity types."

Replacing "target.groupId" with "target/groupId" yields "Parsing OData Select and Expand failed: Could not find a property named 'groupId' on type 'microsoft.graph.deviceAndAppManagementAssignmentTarget'."

Any help in fixing this filtering attempt would be appreciated!

0

There are 0 best solutions below