SPOTenantSettings: : Too many retries performed. More than 3 retries encountered while sending the request.
Description of the issue
I have a very weird error message when trying to export SPOTenantSettings using Certificate Thumbprint
Get-MgAdminSharepointSetting : Too many retries performed. More than 3 retries encountered while sending the request.
Other resources from the Sharepoint module do not exhibit any error at all, either this one, or access denied. Other modules do not warn about any network issue, I've tried with and without the optimization about telemetry and module validation The connection is issued from a Windows Server 2022 machine with connection to the internet.
The output file has a definition written for SPOTenantSettings but I'm not sure if it retrieves default values or not
Microsoft 365 DSC Version
1.25.1112.1
Which workloads are affected
SharePoint Online
The DSC configuration
# Export-M365DSCConfiguration -Components @('SPOTenantSettings') -Path . # and some credentials
param (
)
Configuration M365TenantConfig
{
param (
)
$OrganizationName = $ConfigurationData.NonNodeData.OrganizationName
Import-DscResource -ModuleName 'Microsoft365DSC' -ModuleVersion '1.25.1112.1'
Node localhost
{
SPOTenantSettings "SPOTenantSettings"
{
AllowDownloadingNonWebViewableFiles = $True;
AllowEditing = $True;
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
ApplyAppEnforcedRestrictionsToAdHocRecipients = $True;
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
CommentsOnSitePagesDisabled = $False;
DisableCustomAppAuthentication = $True;
DisabledModernListTemplateIds = @();
DisablePersonalListCreation = $False;
DisplayNamesOfFileViewersInSpo = $True;
EnableAzureADB2BIntegration = $True;
Ensure = "Present";
ExemptNativeUsersFromTenantLevelRestricedAccessControl = $False;
FilePickerExternalImageSearchEnabled = $True;
HideDefaultThemes = $False;
HideSyncButtonOnODB = $False;
IsFluidEnabled = $True;
IsLoopEnabled = $True;
IsSingleInstance = "Yes";
LegacyAuthProtocolsEnabled = $True;
MarkNewFilesSensitiveByDefault = "AllowExternalSharing";
MaxCompatibilityLevel = "15";
MinCompatibilityLevel = "15";
MobileFriendlyUrlEnabledInTenant = $True;
NotificationsInSharePointEnabled = $True;
OfficeClientADALDisabled = $False;
OwnerAnonymousNotification = $True;
PublicCdnAllowedFileTypes = "CSS,EOT,GIF,ICO,JPEG,JPG,JS,MAP,PNG,SVG,TTF,WOFF";
PublicCdnEnabled = $False;
RequireAcceptingAccountMatchInvitedAccount = $False;
SearchResolveExactEmailOrUPN = $False;
SignInAccelerationDomain = "";
SocialBarOnSitePagesDisabled = $False;
SpecialCharactersStateInFileFolderNames = "Allowed";
TenantId = $OrganizationName;
UseFindPeopleInPeoplePicker = $False;
UsePersistentCookiesForExplorerView = $False;
}
}
}
Verbose logs showing the problem
Exporting Microsoft 365 configuration for Components: SPOTenantSettings
Authentication methods specified:
- Service Principal with Certificate Thumbprint
WARNING:
A newer version of PnP PowerShell is available: 3.0.0.
Use 'Update-Module -Name PnP.PowerShell' to update.
Use 'Get-PnPChangeLog -Release 3.0.0' to list changes.
You can turn this check off by setting the 'PNPPOWERSHELL_UPDATECHECK' environment variable to 'Off'.
Connecting to {PnP}...✅
Starting export in sequential mode...
Get-MgAdminSharepointSetting : Too many retries performed. More than 3 retries encountered while sending the
request.
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.1112.1\DSCResources\MSFT_SPOTenantSettings\MS
FT_SPOTenantSettings.psm1:268 char:9
+ $SPOTenantGraphSettings = Get-MgAdminSharepointSetting -Prope ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-MgAdminSharepointSetting_Get], AggregateException
+ FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.GetMgAdminSharepointSetting_Get
[1/1] Extracting [SPOTenantSettings] using {CertificateThumbprint}...✅
⌛ Export took {99 seconds} for {1 instances}
Environment Information + PowerShell Version
OsName : Microsoft Windows Server 2022 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage : en-US
OsMuiLanguages : {en-US}
Name Value
---- -----
PSVersion 5.1.20348.4294
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.4294
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
What happens if you connect directly to Microsoft Graph using Connect-MgGraph with the client id and certificate thumbprint and then run Get-MgAdminSharepointSetting? Does that yield the same error? I did get some results on my machine, so I don't think it's a generic issue.
I get the same result at least with the version mentioned. However it seems that this is the only Sharepoint cmdlet that gives me this. If I run multiple Sharepoint cmdlets in the same Export command, I only get the error for that one. At this first I was thinking it was a transient error so I ran the tests at different times of the day, but had the same answer, even from a fresh Powershell session. I will retry with the version that was just published today in order not lose everybody's time, since I saw the resource was partially updated.
While reviewing the permissions granted to the application registration, it appears there are 2 locations where you can enabled the 'Sites.FullControl.All' permission.
- One directly under Microsoft Graph,
- the other under 'Sharepoint'.
I initially granted the one under the Microsoft Graph API, and I was fine with it since the Get-MgAdminSharepointSetting refers to the Microsoft.Graph.Sites and the other Sharepoint cmdlets ran fine.
I have now granted the permission through the Sharepoint Online API and I'm not able to reproduce the problem anymore.
Thanks for the update👍