Set-SPOTenant : The operation has timed out and Set-SPOSite : The remote server returned an error: (

Contributor

I am trying to run the below command but I get the below error:

 

,(Get-SPOSite -IncludePersonalSite $true -Limit all -Filter "Url -like '-my.sharepoint.com/personal/'") | Set-SPOTenant -ConditionalAccessPolicy AllowLimitedAccess

 

Set-SPOTenant : The operation has timed out.

 

Any ideas how I can get around this error?

 

I have also tried to loop through each site but I sometimes get the below error as well when looping through. 

Set-SPOSite : The remote server returned an error: (429).

 

I presume some sort of throttling is going on with SPO? How can I get around this?

3 Replies
On the first script example, you should have Set-SPOSite instead of Set-SPOTenant.
When 429 error is returned, your calls are being throttled. Adding some delay between calls might help in that case.
Ok thanks blame MS documentation then : ) I just tested using that.

https://docs.microsoft.com/en-us/sharepoint/control-access-from-unmanaged-devices

Will test it with Set-SPOSite then and revert back.
No that does not seem to work either

,(Get-SPOSite -IncludePersonalSite $true -Limit all -Filter "Url -like '-my.sharepoint.com/personal/'") | Set-SPOSite -ConditionalAccessPolicy AllowLimitedAccess
Set-SPOSite : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.