The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
Dear @john john Pter,
Good day! Welcome to Microsoft Q&A forum!
Based on your description, you had been connecting to SharePoint Online through PowerShell without issues, but after switching the Unmanaged devices setting to Allow limited, web‑only access, you began receiving the error: Connect-SPOService : No valid OAuth 2.0 authentication session exists.
Even after reverting the setting to Full access, the error continues. You’re also seeing an access‑blocked message, and although your two related Conditional Access policies are both Off, the problem still persists.
I sincerely apologize the inconvenience caused by this issue.
Regarding the recent change you made in the Unmanaged Devices policy, please note that when you switch the setting back to “Allow full access”, it can take up to 24 hours for the update to propagate across all SharePoint and Microsoft 365 services. During this period, it is normal to continue experiencing the previous restrictions or authentication issues.
Given your current situation where PowerShell connections began failing after switching to “Allow limited, web‑only access” this delay may explain why the issue persists even after reverting the setting. I recommend allowing some time for the policy to fully synchronize.
For your reference, please review the following Microsoft Learn article, which explains how access from unmanaged devices is controlled in SharePoint: IT Admins - SharePoint and OneDrive unmanaged device access controls
If the problem continues beyond that window, please feel free to reach out to me.
I appreciate your time and look forward to hearing how things are going!
Thank you for your time and patience.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in [our documentation] to enable e-mail notifications if you want to receive the related email notification for this thread.