-
Notifications
You must be signed in to change notification settings - Fork 192
Powershell Microsoft.Graph- How to set MaxRetry #1106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@MarkDordoy, the PowerShell SDK does currently not support this. The MaxRetry is currently locked at 3, and the implementation is based on https://microsoftgraph.github.io/msgraph-sdk-design/middleware/RetryHandler.html. Which command are you using? Ideally, the service should respond with a We will consider exposing a way for customers to set their preferred MaxRetry. This will likely be through a global variable. |
I came across this issue when using this call: Ifs fine for a while, but i was running this within a foreach-Object -Parallel script block so i guess i was hitting 429s and 3 retries was not enough (I think). |
Error that is caught: Get-MgAuditLogDirectoryAudit_List:
Line |
25 | … toryAudit -Filter "targetResources/any(t: t/id eq '$($user.Id)') and …
| ~~~~~~~~
| Code: tooManyRetries
Message: More than 3 retries encountered while sending the request. It throws an exception type of $_.Exception.Error
Code : tooManyRetries
Message : More than 3 retries encountered while sending the request.
Target :
Details :
InnerError :
ThrowSite :
ClientRequestId :
AdditionalData : Stack Trace: $_.Exception.StackTrace
at Microsoft.Graph.RetryHandler.SendRetryAsync(HttpResponseMessage response, CancellationToken cancellationToken)
at Microsoft.Graph.RetryHandler.SendAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken)
at Microsoft.Graph.CompressionHandler.SendAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken)
at Microsoft.Graph.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at Microsoft.Graph.PowerShell.Reports.AuditLogsListDirectoryAudits_Call(HttpRequestMessage request, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
at Microsoft.Graph.PowerShell.Reports.AuditLogsListDirectoryAudits_Call(HttpRequestMessage request, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
at Microsoft.Graph.PowerShell.Reports.AuditLogsListDirectoryAudits(Nullable`1 Top, Nullable`1 Skip, String Search, String Filter, Nullable`1 Count, String[] Orderby, String[] Select, String[] Expand, Func`3 onOk, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
at Microsoft.Graph.PowerShell.Cmdlets.GetMgAuditLogDirectoryAudit_List.ProcessRecordAsync()``` |
Got it! We will need to allow customers to set |
@peombwa I have the impression the max retries and retry after was already covered by another PR of the v2 work you did. Just checking. |
@maisarissi, this is still an open feature request. It hasn't been implemented in v2. I'll expedite its implementation in v1 since it is blocking customers. |
Hi @peombwa. When will this be available for |
Is there a way to set the max retry value for the Microsoft.Graph powershell modules.
I'm hitting an issue from time to time, where a particular cmdlet retries 3 times then fails. Ideally i'd like a way to increase this somehow. Is this supported?
This supports the theory that it is set to 3 and backs up what im seeing.
Thanks
The text was updated successfully, but these errors were encountered: