Last active
March 22, 2023 23:18
-
-
Save mozziemozz/070c44a49274159f66c8b42fb3a2bbf1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $allPages = @() | |
| $aadUsers = (Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/users?`$top=5" -Headers $Header -Method Get -ContentType "application/json") | |
| $allPages += $aadUsers.value | |
| if ($aadUsers.'@odata.nextLink') { | |
| do { | |
| $aadUsers = (Invoke-RestMethod -Uri $aadUsers.'@odata.nextLink' -Headers $Header -Method Get -ContentType "application/json") | |
| $allPages += $aadUsers.value | |
| } until ( | |
| !$aadUsers.'@odata.nextLink' | |
| ) | |
| } | |
| $aadUsers = $allPages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment