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

-First parameter for Get-AzAD* commands doesn't behave as expected #25464

Open
alexandair opened this issue Jul 7, 2024 · 1 comment
Open
Assignees
Labels
Azure PS Team bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Graph.Microsoft Tracking We will track status and follow internally

Comments

@alexandair
Copy link
Contributor

Description

Get-AzAdUser -First 1 or Get-AzAdGroup -First 1 should be implemented using the $top query parameter. In other words, the action should be on the server side. At the moment, things are happening on the client side--a bunch of Entra objects are part of the response, and then the first object is picked on the client side.

Also, -First parameter should have an alias parameter -Top.

Issue script & Debug output

PS> Get-AzAdUser -First 1 -Debug

DEBUG: ============================ HTTP REQUEST ============================
HTTP Method: GET
Absolute Uri:
https://graph.microsoft.com/v1.0/users

It should be:

DEBUG: ============================ HTTP REQUEST ============================
HTTP Method: GET
Absolute Uri:
https://graph.microsoft.com/v1.0/users?$top=1

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

PS> get-module az*

ModuleType Version    PreRelease Name         
---------- -------    ---------- ----         
Script     2.19.0                Az.Accounts  
Script     6.16.2                Az.Resources

Error output

No response

@alexandair alexandair 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 Jul 7, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported needs-triage This is a new issue that needs to be triaged to the appropriate team. and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Jul 7, 2024
@isra-fel
Copy link
Member

We implemented client-side filtering cause MSGraph (or its swagger spec) did not support OData query back then. But now it's worth investing in.
Note that the current implementation pulls enough data (not all of it) to the client-side before filtering.

@isra-fel isra-fel added Azure PS Team Graph.Microsoft Tracking We will track status and follow internally and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure PS Team bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Graph.Microsoft Tracking We will track status and follow internally
Projects
None yet
Development

No branches or pull requests

3 participants