I have the same issue, there two errors we get 401 for disconnection and 429 for throttling issues.
Used this to check for connectivity instead of disconnect/reconnect: { $context = Get-MgContext
if (-not $context) { write-host -ForegroundColor yellow "Connecting Graph"
Connect-MgGraph -ClientId $ClientID -TenantId $TenantID -Certificate $ClientCertificate -NoWelcome
} else {
write-host -ForegroundColor yellow "Graph already connected"
} } Used this to help throttle the requests when in a loop:
{ #Anti-throttling control Start-Sleep -Milliseconds 300 } I think they are related issues where the backend SP server is kicking out connections when overused without throttling.