How to close OneDrive

OneDrive is a convenient online storage for personal use and working with multiple devices. However, if you are using other online storage, the increase in the number of locations where you store your information can lead to increased management costs and information leaks. This section will introduce how to close OneDrive, which can be used in such cases.

Prerequisites


  • If you block OneDrive, you will not be able to use the chat function of Teams to share files (you can share files with your team).
  • Windows PowerShell and SharePoint Online Management Shell need to be installed.
    • Prepare a Windows PC that can run the SharePoint Online Management Shell.
    • For details on how to set up the SharePoint Online Management Shell, please refer to the following
  • The following Azure AD Role must be associated with the work user
  • Global administrator (I have not tried this, but SharePoint administrator may be a good substitute)

Procedure(Closing OneDrive)


Connect to the SharePoint Administration Center

1) Launch the SharePoint Online Management Shell
2) Execute the following command to connect to the SharePoint Management Center
Connect-SPOService -Url https://<tenant name>-admin.sharepoint.com

If you want to prohibit all users from using OneDrive

3-a) Execute the following command to prevent all users from accessing OneDrive
$personalSites = Get-SPOSite -IncludePersonalSite $true -Limit All | where Template -like 'SPSPERS#*'
$personalSites | Set-SPOSite -LockState NoAccess

If you want to prohibit the use of OneDrive only for a specific user

3-b) Execute the following command to prohibit the use of OneDrive only for a specific user
Set-SPOSite -Identity <URL of personal site> -LockState NoAccess
The URL of your personal site should be specified in the following format

Operation check


1) Try to access OneDrive as a user who is prohibited from accessing.
2) If you can confirm that you cannot connect, you are done.

Procedure(When you want to resume usage)


If you want to resume the use of OneDrive for all users

Start the SharePoint Online Management Shell and execute the following command
$personalSites = Get-SPOSite -IncludePersonalSite $true -Limit All | where Template -like 'SPSPERS#*'
$personalSites | Set-SPOSite -LockState Unlock

If you want to resume OneDrive usage for specific users only

Start the SharePoint Online Management Shell and execute the following command
Set-SPOSite -Identity <URL of personal site> -LockState Unlock

Comments