New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get-AzADGroupMember no longer returns service principals #16698
Comments
Thanks for the information. We need to update the documentation accordingly. |
Hi Simon@sopelt Thanks for reporting this issue, I have created PR to improve doc from Azure-PowerShell. This will be present in official doc early next month. |
@VeryEarly @mikefrobbins we need to also add this in the migration guide. |
This has just tripped us up on existing deployment scripts, what is the ETA of the staged rollout that will mean they will returned in the results again? |
@dcaro This has also broken our Azure DevOps deployment scripts that required service principals to be returned in the list. Can you provide any alternative workarounds until this is fixed? |
@krispenner we are working on providing a workaround in our official docs using the |
Just to add weight to this, it's breaking our scripts too. Have subscribed in hope of finding a resolution. |
As a workaround, Invoke-AzRestMethod can be used with the beta version of the Microsoft Graph API. The following example requires the Az PowerShell module. Replace $Group = Get-AzADGroup -DisplayName myGroupName
((Invoke-AzRestMethod -Uri "https://graph.microsoft.com/beta/groups/$($Group.id)/members").Content |
ConvertFrom-Json).value |
Select-Object -Property DisplayName, Id, @{label='OdataType';expression={$_.'@odata.type'}} |
@mikefrobbins thank you, your workaround is working for us. Is there any plan to fix |
Once the rollout has been completed by Microsoft Graph the cmdlet behavior will be addressed. |
Is there an ETA for the MS Graph rollout? |
@wyunchi-ms I don't agree with this issue being closed just because docs have been updated with this current limitation, at the minimum I want another tracking issue because calling the graph api is significantly slower |
Report it because issue was closed automatically due to linked PR was merged. |
Description
In versions prior to 7 Get-AzADGroupMember returned all members (users, groups, service principals) of a group. Starting with 7 it moved from the legacy graph.windows.net to microsoft graph.
This seems to be caused by a limitation that is briefly mentioned in the documentation of the REST API:
This change breaks existing powershell code in a dangerous way as there are no errors/warnings but just empty/partial results that can cause wrong turns in the subsequent logic/flow.
The provided debug output only reflects the group member with "objectType": "User" but the entries with "objectType": "ServicePrincipal" are missing.
I also opened https://github.com/microsoftgraph/microsoft-graph-docs-contrib/issues/2630 to get more information and maybe trigger a short-term documentation improvement.
Kind regards,
Simon
Issue script & Debug output
Environment data
Module versions
Error output
The text was updated successfully, but these errors were encountered: