entra-powershell icon indicating copy to clipboard operation
entra-powershell copied to clipboard

ADD Get-EntraUser -PageSize parameter

Open HCRitter opened this issue 1 year ago • 4 comments

Describe the feature

Add the "Pagesize" parameter to increase the result limit for pagination, for Graph is 999 elements

How will this feature enhance your project and further the project’s overall goals? Who will benefit from this feature (i.e. all users; the project team)?

This change would make retrieving all user objects much faster, and throttling should not be a big deal if your tenant has 10k+ users. So this would be beneficial for all users.

Describe alternatives you've considered Still use Get-MGuser -Pagesize 999 -all

Additional context None

HCRitter avatar Jul 05 '24 06:07 HCRitter

@HCRitter Thanks for raising the issue, We are looking into it.

snehalkotwal avatar Jul 05 '24 08:07 snehalkotwal

related to https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2769 ?

Licantrop0 avatar Jul 14 '24 18:07 Licantrop0

It's kinda related, as -all should be by default 999 in page size. But also for -top the user should be able to specify the -pagesize parameter, to fit the needs :)

HCRitter avatar Jul 14 '24 18:07 HCRitter

yeah, theoretically they should be aliases... @peombwa can you please chime in and explain why they are different? You wrote this PR: https://github.com/microsoftgraph/msgraph-sdk-powershell/pull/1541

Licantrop0 avatar Jul 14 '24 19:07 Licantrop0

The -All, -Top, and -PageSize parameters all influence the size and structure of the output when querying data. However, if you're using aliases or simplified command forms, their behavior may not always apply consistently. When -PageSize is specified, the command may make multiple network calls to retrieve data in chunks (pages), continuing until it reaches the limit defined by either -Top or -All, depending on which is used.

An example would be:

Get-EntraUser -All -PageSize 50

If I have 70 users, 2 calls will be made to retrieve the full dataset with the first returning 50 and next returning 20 for the total of 70.

If I use -Top for the same tenant with 70 users for instance:

Get-EntraUser -Top 40 -PageSize 15

I should get 3 network calls made of 15, 15, 10 which would retrieve upto 40 results only.

givinalis avatar Aug 25 '25 08:08 givinalis