Get-MgGroup Throttling issue?
Hi,
I've created a PowerShell script runbook for Azure Automation to update a SharePoint list that is working as a Teams Directory. The script gets all teams and then checks if it needs to add or update the corresponding item in the list. After that, it runs through the list items and checks if the group still exists and deletes the item if it is gone.
In testing the script, I found that the job was always restarting somewhere in the middle of the processing of the list items, i.e. while trying to get a group by ID a bunch of times. There was no exception thrown, the script just halted and the job would restart automatically. After a bit of investigation, I thought perhaps I was getting throttled, and so I've added a "sleep" command now after every 10 "gets" of a group and that solved the issue.
However, it would have been nice to get some kind of "you've been throttled" exception that we could catch and handle gracefully. And it would have helped me figure out what was going on sooner.
We do have an inbuilt retry handler that handles throttling and fails after 3 attempts, see https://github.com/microsoftgraph/msgraph-sdk-design/blob/master/middleware/RetryHandler.md.
Also, you should specify a -ErrorAction Stop when using our commands since we support non-terminating errors.
Is it possible to share a sanitized fiddler trace or repro steps for this?
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.