Every Graph script I write starts the same way: a do/while around @odata.nextLink, a try/catch for HTTP 429, and a guess about which scopes the token needs. After the third copy-paste I made it a module.
What it does
- Paging —
Get-MgPagedResultfollowsnextLinkuntil the collection is exhausted and returns a flat array. - Throttling — honours the
Retry-Afterheader instead of sleeping a hard-coded number. - Scope detection — compares
(Get-MgContext).Scopesagainst what the call needs and fails early with a readable message.
Status
v0.1.0, used in anger against two tenants. Not published yet — the error messages still assume you know what a nextLink is.