Search code examples
azureazure-active-directorymicrosoft-graph-apimigrationpipeline

Invalid filter clause. Microsoft.Graph


I'm trying to get an Azure AD Role Assignment using Microsoft.Graph PowerShell module.

I'm running a command below:

$assignments = Get-MgGroupAppRoleAssignment -GroupId $group.Id  -Filter "ResourceId eq '$($sp.Id)'" | Format-List

where $sp is the service principal object that was successfully found.

I'm getting the next error:

##[error]Invalid filter clause
##[error]PowerShell exited with code '1'.

I was trying to replace the old AzureAD command Get-AzureADGroupAppRoleAssignment with the new Microsoft.Graph Get-MgGroupAppRoleAssignment.

Thanks in advance!


Solution

  • I believe you are getting this error is because you are passing the resource id as string. Resource id type is actually a GUID.

    Please try the following command:

    $assignments = Get-MgGroupAppRoleAssignment -GroupId $group.Id  -Filter "ResourceId eq $($sp.Id)" | Format-List