When performing an API query, you cannot limit the results because it will always load @odata.nextlink. When testing queries its often useful to sample the results.
Eg. Running the following query should give you 5 results and is useful for sampling.
https://graph.microsoft.com/beta/users?$limit=5&$select=userprincipalname,displayName,signInActivity,onPremisesDistinguishedName,accountEnabled
Current outcome - results are returned in full, but in page sizes of 5 results.
Possible solution - add a function parameter that, if set (eg -singlepageresults = $true), sets a the @uri variable to $null thus never running the loop more than once.
When performing an API query, you cannot limit the results because it will always load @odata.nextlink. When testing queries its often useful to sample the results.
Eg. Running the following query should give you 5 results and is useful for sampling.
https://graph.microsoft.com/beta/users?$limit=5&$select=userprincipalname,displayName,signInActivity,onPremisesDistinguishedName,accountEnabled
Current outcome - results are returned in full, but in page sizes of 5 results.
Possible solution - add a function parameter that, if set (eg -singlepageresults = $true), sets a the @uri variable to $null thus never running the loop more than once.