Open jikuja opened 1 week ago
Good point. Thanks for the feedback!
IMO, not finding something (for supported param and type) should never be an error. Maybe an warning, but best is that the return is just a $null.
I've seen similar issues on multiple Cmdlets. The process:
exatly same issue is present also on Add-AzGroupMember: https://github.com/Azure/azure-powershell/blob/main/src/Resources/MSGraph.Autorest/custom/Add-AzADGroupMember.ps1#L119
IMO, not finding something (for supported param and type) should never be an error. Maybe an warning, but best is that the return is just a $null.
+1 on this comment; you really shouldn't be throwing exceptions/errors in non-exceptional circumstances...
Hi @isra-fel, Can I work on this issue?
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