Get-AzADGroupMember should return better error message if group does not exist #26237
Labels
Azure PS Team
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
customer-reported
good first issue
Issues suited for folks who want to help for the first time.
Graph.Microsoft
Tracking
We will track status and follow internally
Description
Cmdlet does not check if Get-ADGroup query returns group(s): https://github.com/Azure/azure-powershell/blob/main/src/Resources/MSGraph.Autorest/custom/Get-AzADGroupMember.ps1#L132-L137
The current error message(
Get-AzADGroupMember: Cannot bind argument to parameter 'GroupId' because it is an empty string.
) is really misleading because used does not supply GroupId.Cmdlet should check that Get-AzADGroup returns exactly on group or error with human-readable error message. This check should be done on all Cmdlets using Graph API to solve Displayname or any other filtering and remaining logic assumes that Get-AzADGroup/User/serviceprincipal returns exactly one item.
Issue script & Debug output
Environment data
Module versions
Error output
The text was updated successfully, but these errors were encountered: