microsoftgraph / entra-powershell

Microsoft Entra PowerShell
https://aka.ms/entraps
MIT License
25 stars 1 forks source link

Get-EntraGroupMember doesn't return service principals as members #882

Open alexandair opened 4 days ago

alexandair commented 4 days ago

As you can see in the following code snippets, AzureAD command returns the correct output while Entra command doesn't output service principal members:

Get-AzureAdGroup -ObjectId 'b0c07cae-5f21-49db-b4a3-c42f53b98a8d' | 
Get-AzureAdGroupMember | 
Select-Object DisplayName,ObjectType

DisplayName        ObjectType      
-----------        ----------
Microsoft Azure    ServicePrincipal
Aleksandar Nikolic User
Alex Wilber        User
testgroup1         Group
Diegos App3        ServicePrincipal
Get-EntraGroup -ObjectId 'b0c07cae-5f21-49db-b4a3-c42f53b98a8d' |
 Get-EntraGroupMember |
 Select-Object DisplayName,'@odata.type'

displayName        @odata.type
-----------        -----------
Aleksandar Nikolic #microsoft.graph.user
Alex Wilber        #microsoft.graph.user
testgroup1         #microsoft.graph.group

Problem lies in v1.0 version of Microsoft Graph API and Get-MgGroupMember used under the covers. It's a known issue that's not fixed for months (years?). Strangely, Get-MgGroupMemberAsServicePrincipalworks as expected.

image

snehalkotwal commented 3 days ago

@alexandair Thanks for raising the issue, We are looking into it.