Update-MgAdminSharepointSetting: Too many retries performed. More than 3 retries
I am trying to update Sharepoint Tenant settings with 1260+ domains for sharingAllowedDomainList using either on of the following cmdlets:
Getting the same issue with: $Uri = "https://graph.microsoft.com/v1.0/admin/sharepoint/settings" Invoke-MgGraphRequest -Uri $Uri -Method Patch -Body $updateBody
but also with: Update-MgAdminSharepointSetting -SharingAllowedDomainList $allowedDomains Update-MgAdminSharepointSetting_UpdateExpanded: Too many retries performed. More than 3 retries encountered while sending the request. (HTTP request failed with status code: GatewayTimeout.
I've tried reinstalling Microsoft.Graph modules, attempted in both Poweshell 5+ and 7+ as well. Same things happens if script is run in Azure Automation runbook.
Microsoft.Graph version 2.25 and 2.24 same issue
Expected behavior
Expected behavior should be long running time ( 1200+ domains ) but then list updated, no error
How to reproduce
- Connect-MgGraph -TenantId $TenantId -ClientSecretCredential $Global:ClientCredentials
- $Uri = "https://graph.microsoft.com/v1.0/admin/sharepoint/settings"
- $SPOSettings = Invoke-MgGraphRequest -Uri $Uri -Method Get
- $allowedDomains = $SPOSettings.sharingAllowedDomainList
- $allowedDomains+="contoso.com"
- $updateBody = @{ sharingAllowedDomainList = $allowedDomains }
- Invoke-MgGraphRequest -Uri $Uri -Method Patch -Body $updateBody
or
- Connect-MgGraph -TenantId $TenantId -ClientSecretCredential $Global:ClientCredentials
- $SPOSettings = Get-MgAdminSharepointSetting
- $allowedDomains = $SPOSettings.sharingAllowedDomainList
- $allowedDomains+="contoso.com"
- Update-MgAdminSharepointSetting -SharingAllowedDomainList $allowedDomains -Debug
or
Either one of the above in Azure Automation runbook Powershell version 7.2
SDK Version
2.25.0,2.24.0,Beta
Latest version known to work for scenario above?
No response
Known Workarounds
no workaround with Microsoft Graph issue persists with Microsoft.Graph.Beta.Sites
This is not reliable at all, even with Retry-After 240, it errors out, although it adds the domains.
Same error with 600 Retry-After:
I've tried reinstalling Microsoft.Graph modules, attempted in both Poweshell 5+ and 7+ as well.
Same things happens if script is run in Azure Automation runbook.
Microsoft.Graph version 2.25 and 2.24 same issue
Expected behavior
Expected behavior should be long running time ( 1200+ domains ) but then list updated, no error
How to reproduce
- Connect-MgGraph -TenantId $TenantId -ClientSecretCredential $Global:ClientCredentials
- $Uri = "https://graph.microsoft.com/v1.0/admin/sharepoint/settings"
- $SPOSettings = Invoke-MgGraphRequest -Uri $Uri -Method Get
- $allowedDomains = $SPOSettings.sharingAllowedDomainList
- $allowedDomains+="contoso.com"
- $updateBody = @{
sharingAllowedDomainList = $allowedDomains
} - Invoke-MgGraphRequest -Uri $Uri -Method Patch -Body $updateBody
or
- Connect-MgGraph -TenantId $TenantId -ClientSecretCredential $Global:ClientCredentials
- $SPOSettings = Get-MgAdminSharepointSetting
- $allowedDomains = $SPOSettings.sharingAllowedDomainList
- $allowedDomains+="contoso.com"
- Update-MgAdminSharepointSetting -SharingAllowedDomainList $allowedDomains -Debug
or
Either one of the above in Azure Automation runbook Powershell version 7.2
SDK Version
2.25.0,2.24.0,Beta
Latest version known to work for scenario above?
No response
Known Workarounds
no workaround with Microsoft Graph
issue persists with Microsoft.Graph.Beta.Sites
This is not reliable at all, even with Retry-After 240, it errors out, although it adds the domains.
Same error with 600 Retry-After:
Debug:
Confirm Continue with this operation? [Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y DEBUG: [CmdletException]: Received exception with message 'AggregateException - Too many retries performed. More than 3 retries encountered while sending the request. : at Microsoft.Kiota.Http.HttpClientLibrary.Middleware.RetryHandler.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Kiota.Http.HttpClientLibrary.Middleware.RetryHandler.d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Kiota.Http.HttpClientLibrary.Middleware.CompressionHandler.d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Authentication.Handlers.AuthenticationHandler.d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.Beta.PowerShell.Sites.<AdminSharepointUpdateSetting_Call>d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Graph.Beta.PowerShell.Sites.<AdminSharepointUpdateSetting_Call>d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.Beta.PowerShell.Sites.d__16.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.Beta.PowerShell.Cmdlets.UpdateMgBetaAdminSharepointSetting_UpdateExpanded.d__148.MoveNext()'
Confirm Continue with this operation? [Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y
Confirm Too many retries performed. More than 3 retries encountered while sending the request. [Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y Update-MgBetaAdminSharepointSetting : Too many retries performed. More than 3 retries encountered while sending the request. At line:1 char:1
- Update-MgBetaAdminSharepointSetting -SharingAllowedDomainList $allowe ...
-
+ CategoryInfo : NotSpecified: (:) [Update-MgBetaAd..._UpdateExpanded], AggregateException + FullyQualifiedErrorId : Microsoft.Graph.Beta.PowerShell.Cmdlets.UpdateMgBetaAdminSharepointSetting_ UpdateExpanded
DEBUG: [CmdletEndProcessing]: - Update-MgBetaAdminSharepointSetting end processing.
Confirm Continue with this operation? [Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y PS C:\Users\laszl>
</details>
### Configuration
- OS: Windows 10
- Powershell 5.1
- Powershell 7.4.6
or
- Azure Automation
- PowerShell 7.2
### Other information
_No response_