Skip to content
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 -select doesn't return user properties #19728

Closed
plmcgrn opened this issue Oct 4, 2022 · 12 comments · Fixed by #21759
Closed

Get-AzAdGroupMember -select doesn't return user properties #19728

plmcgrn opened this issue Oct 4, 2022 · 12 comments · Fixed by #21759
Assignees
Labels
AAD AzAd cmdlets in Az.Resources bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported needs-team-attention This issue needs attention from Azure service team or SDK team Service Attention This issue is responsible by Azure service team. Tracking We will track status and follow internally

Comments

@plmcgrn
Copy link

plmcgrn commented Oct 4, 2022

Description

When using Get-AzAdGroupMember with the -select parameter, the returned results do not contain the user properties requested. When I test this using the beta API directly, it does return the fields properly.

This is the same as Issue #17503 , which was auto-closed without a fix. The MS Graph API being used is a beta API that includes all this data, so it should be supported. Also, I noted that the comment linking to the supported properties isn't accurate. If I do -Select mail, I get no data from the cmdlet even though that property is in the raw API response.

Issue script & Debug output

$id = 'redacted'
$userProps = "id", "displayName", "mail"
$users = Get-AzADGroupMember -GroupObjectId $id -Select $userProps

Can't provide output without redacting to the point of irrelevance.  I confirmed that all 3 properties were part of the response from the Graph API.

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.0
PSEdition                      Core
GitCommitId                    7.2.0
OS                             Darwin 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:05 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.10.1                Az.Accounts                         
Script     6.2.0                 Az.Resources

Error output

No relevant errors returned
@plmcgrn plmcgrn added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Oct 4, 2022
@ghost ghost added customer-reported and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Oct 4, 2022
@dingmeng-xue dingmeng-xue added the AAD AzAd cmdlets in Az.Resources label Oct 6, 2022
@dingmeng-xue
Copy link
Member

@VeryEarly , please help to look into it.

@RakeshMohanMSFT RakeshMohanMSFT self-assigned this Oct 26, 2022
@RakeshMohanMSFT
Copy link
Contributor

RakeshMohanMSFT commented Oct 26, 2022

@plmcgrn Can you please trying upgrading the modules as shown below?
image

@RakeshMohanMSFT RakeshMohanMSFT added needs-author-feedback More information is needed from author to address the issue. CXP Attention [Deprecated] The Azure CXP Support Team is responsible for this issue. labels Oct 26, 2022
@ghost
Copy link

ghost commented Oct 26, 2022

Thank you for your feedback. This has been routed to the support team for assistance.

@plmcgrn
Copy link
Author

plmcgrn commented Oct 26, 2022

@plmcgrn Can you please trying upgrading the modules as shown below? image

Az.Account updates to 2.10.2 but Az.Resources updates to 6.2.0 not 6.3.0, for me.

redacted> get-module Az*                                                 

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.10.2                Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script     6.2.0                 Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-A…

Regardless, retrying gives same results.

$userProps = "id", "displayName", "givenName", "country"
$id = 'redacted'
$gm = Get-AzAdGroupMember -GroupObjectId $id -Select $userProps

The results do not contain givenName or country.

@ghost ghost added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. labels Oct 26, 2022
@RakeshMohanMSFT
Copy link
Contributor

RakeshMohanMSFT commented Oct 31, 2022

@plmcgrn Its actually as designed. You can use this command as a work around to get the GivenName and country
Get-AzADGroupMember -ObjectId a5819190-0f06-45c6-bcf2-434a119225ed | where-object {$_.OdataType.Contains("user")} | foreach-object {Get-AzADUser -ObjectId $_.Id -Select Id,displayName,userPrincipalName}

@RakeshMohanMSFT RakeshMohanMSFT added needs-author-feedback More information is needed from author to address the issue. issue-addressed and removed needs-team-attention This issue needs attention from Azure service team or SDK team needs-author-feedback More information is needed from author to address the issue. labels Oct 31, 2022
@ghost
Copy link

ghost commented Nov 2, 2022

Hi @plmcgrn. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

@ghost
Copy link

ghost commented Nov 9, 2022

Hi @plmcgrn, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

@ghost ghost closed this as completed Nov 9, 2022
@PSdasAndi
Copy link

PSdasAndi commented Dec 14, 2022

@RakeshMohanMSFT I don't understand this. If this is as designed, then why does Get-AzGroupMember have "-Select" as a parameter? Will the parameter be removed from the cmdlet? /unresolve

Also, your example is Get-AzADGroupMember -ObjectId, the documentation only has -GroupObjectId.
Will that change in the future?

@plmcgrn
Copy link
Author

plmcgrn commented Jan 21, 2023

/unresolve
"As designed" is s cop-out. Either -select is supported, or it's not. If not, remove it from the cmdlet.

@ghost ghost reopened this Jan 21, 2023
@ghost ghost added needs-team-attention This issue needs attention from Azure service team or SDK team and removed issue-addressed labels Jan 21, 2023
@RakeshMohanMSFT
Copy link
Contributor

@PSdasAndi @plmcgrn Let me involve the service team to address this concern.

@RakeshMohanMSFT RakeshMohanMSFT removed their assignment Jan 23, 2023
@RakeshMohanMSFT RakeshMohanMSFT added the Service Attention This issue is responsible by Azure service team. label Jan 23, 2023
@RakeshMohanMSFT RakeshMohanMSFT removed the CXP Attention [Deprecated] The Azure CXP Support Team is responsible for this issue. label Jan 23, 2023
@ghost
Copy link

ghost commented Jan 23, 2023

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @adamedx.

Issue Details

Description

When using Get-AzAdGroupMember with the -select parameter, the returned results do not contain the user properties requested. When I test this using the beta API directly, it does return the fields properly.

This is the same as Issue #17503 , which was auto-closed without a fix. The MS Graph API being used is a beta API that includes all this data, so it should be supported. Also, I noted that the comment linking to the supported properties isn't accurate. If I do -Select mail, I get no data from the cmdlet even though that property is in the raw API response.

Issue script & Debug output

$id = 'redacted'
$userProps = "id", "displayName", "mail"
$users = Get-AzADGroupMember -GroupObjectId $id -Select $userProps

Can't provide output without redacting to the point of irrelevance.  I confirmed that all 3 properties were part of the response from the Graph API.

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.0
PSEdition                      Core
GitCommitId                    7.2.0
OS                             Darwin 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:05 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.10.1                Az.Accounts                         
Script     6.2.0                 Az.Resources

Error output

No relevant errors returned
Author: plmcgrn
Assignees: -
Labels:

AAD, Service Attention, bug, customer-reported, needs-team-attention, CXP Attention

Milestone: -

@adamedx
Copy link

adamedx commented Jan 30, 2023

@RakeshMohanMSFT , not sure how I can help. Do you know who owns this command? I can certainly give advice as to how to debug the request being made to the API, but I have not made contributions to this or any Azure modules. Feel free to ping me out of badn @RakeshMohanMSFT .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AAD AzAd cmdlets in Az.Resources bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported needs-team-attention This issue needs attention from Azure service team or SDK team Service Attention This issue is responsible by Azure service team. Tracking We will track status and follow internally
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants