How to Grant Access to another User’s OneDrive for Business Site in Office 365?

Requirement: Grant access to OneDrive for business to another user.

By default, When the user creates SharePoint My Site or OneDrive site collection, SharePoint assigns the primary site collection administrator or the OneDrive Owner rights to the user. In some cases, you may need to access another user’s OneDrive for Business site. E.g., The user left the company, and the manager of the user wants to gain access, Backup purposes, compliance, delegation, security, etc. This article will walk you through how to give access to OneDrive for Business site to another user.

Access Any User’s OneDrive site as a Global Administrator

If you have “Global Administrator” rights, follow these steps to access OneDrive for any user in the tenant:

  1. Log in to the Microsoft Admin portal at https://admin.microsoft.com/,
  2. Expand Users >> Active Users >> Search and find the user to get OneDrive site access.
  3. Click on the user name to open the property pane >> Click on the “OneDrive” tab and then click on the “Create link to files” link. This creates a link to the OneDrive site of the user and adds you as site collection administrator to that site.
    access another users onedrive site

What if you have only “SharePoint Admin” rights but not a global administrator?

How to Grant Admin access to Another User on a OneDrive for Business site in Office 365?

How to grant access to OneDrive for Business site to another user? To gain access to a user’s OneDrive site, follow these steps:

  1. Login to SharePoint Online Admin Center.
  2. Click on the “More Features” and then the “User Profiles” link from the left navigation.
  3. Click on the “Manage User Profiles” link under the “People” group.
    change onedrive site collection administrator
  4. Search and pick the user profile to which you want to gain access. From the search result, click on the menu item “Manage site collection owners” from the context menu.
    Add administrator to onedrive for business in office 365
  5. By default, The owner of the OneDrive site collection is listed as the Primary Site Collection Administrator and in Site Collection Administrators. (You can have only one primary site collection Admin!). Add any additional administrators to the site collection in the “Site Collection Administrators” field. You can change the primary site collection administrator as well as remove the owner from OneDrive for Business site.
    change site collection administrator for onedrive site collection
  6. Click on “OK” to commit your changes!

Now, you can gain access to all files and folders for the particular user. Instead of manually doing these steps to gain access to the OneDrive site, you can use the PowerShell script to add administrator permissions to OneDrive for business sites.

PowerShell to Add Site Collection Administrator to OneDrive for Business Site Collection

If you need to access another user’s OneDrive for Business site, you’ll need to either change the site collection owner or add additional administrators to the site collection. Use this PowerShell script on SharePoint Online Management Shell to add an administrator to OneDrive for business.

#Set Runtime Parameters
$AdminSiteURL="https://crescent-admin.sharepoint.com"
$OneDriveSiteUrl="https://crescent-my.sharepoint.com/personal/biadmin_crescent_com"
$SiteCollAdmin="salaudeen@crescent.com"

#Get Credentials to connect to SharePoint Admin Center
$Cred = Get-Credential

#Connect to SharePoint Online Admin Center
Connect-SPOService -Url $AdminSiteURL -credential $Cred

#Add Site Collection Admin to the OneDrive
Set-SPOUser -Site $OneDriveSiteUrl -LoginName $SiteCollAdmin -IsSiteCollectionAdmin $True
Write-Host "Site Collection Admin Added Successfully!"

This PowerShell grants the owner access to OneDrive for business to another user.

Grant Admin Access to All OneDrive for Business Site Collections

As there is no direct user interface to add a site collection administrator to OneDrive for Business sites, Here is the PowerShell script you can utilize to add additional administrators in bulk:

#Set Runtime Parameters
$AdminSiteURL="https://crescent-admin.sharepoint.com"
$SiteCollAdmin="SPAdmin@crescent.com"

#Get Credentials to connect to the SharePoint Admin Center
$Cred = Get-Credential

#Connect to SharePoint Online Admin Center
Connect-SPOService -Url $AdminSiteURL -credential $Cred

#Get all OneDrive for Business Site collections
$OneDriveSites = Get-SPOSite -Template "SPSPERS" -Limit ALL -IncludePersonalSite $True
Write-Host -f Yellow "Total Number of OneDrive Sites Found: "$OneDriveSites.count

#Add Site Collection Admin to each OneDrive
Foreach($Site in $OneDriveSites)
{
    Write-Host -f Yellow "Adding Site Collection Admin to: "$Site.URL 
    Set-SPOUser -Site $Site.Url -LoginName $SiteCollAdmin -IsSiteCollectionAdmin $True
}
Write-Host "Site Collection Admin Added to All OneDrive Sites Successfully!" -f Green

This script adds site collection admin to all OneDrive for Business site collections. By adding a user as a site owner or site collection administrator, you are granting full access to all the files and folders on the site. How about adding a new admin to all existing sites where a particular user was a site owner?

#Parameters
$TenantAdminURL = "https://crescent-admin.sharepoint.com"
$OldAdminID = "Salaudeen@crescent.com"
$NewAdminID = "Steve@crescent.com"

#Connect to SharePoint Admin Center
Connect-SPOService -url $TenantAdminURL

#Get All Sites where a particular user is owner
$Sites  =  Get-SPOSite -IncludePersonalSite $true -Limit All | Where {$_.Owner -eq $OldAdminID}

#Add NewAdmin as Site Collection Owner to all sites
$Sites | ForEach-Object { 
    Set-SPOUser -Site $_.Url -LoginName $NewAdminID -IsSiteCollectionAdmin $True
    Write-host "Added Site collection Admin to" $_.URL
}

PnP PowerShell to Add Site Collection Admin to OneDrive Site

Here is how to add OneDrive for Business site collection administrator with PowerShell:

#Set Runtime Parameters
$AdminSiteURL="https://crescent-admin.sharepoint.com"
$OneDriveSiteUrl="https://crescent-my.sharepoint.com/personal/sjackson_crescent_com"
$SiteCollAdmin="salaudeen@crescent.is"
 
#Connect to PnP Online
Connect-PnPOnline -Url $AdminSiteURL -Interactive

#Change OneDrive Ownership
Set-PnPTenantSite -Url $OneDriveSiteUrl -Owners $SiteCollAdmin

Similarly, You can add a site collection administrator to all OneDrive for business sites as:

#Set Parameters
$AdminSiteURL="https://crescent-admin.sharepoint.com"
$SiteCollAdmin="salaudeen@crescent.com"
 
#Connect to PnP Online to the Tenant Admin Site
Connect-PnPOnline -Url $AdminSiteURL -Interactive
 
#Get All OneDrive Sites
$OneDriveSites = Get-PnPTenantSite -IncludeOneDriveSites -Filter "Url -like '-my.sharepoint.com/personal/'"

#Loop through each site
ForEach($Site in $OneDriveSites)
{ 
    #Add Site collection Admin
    Set-PnPTenantSite -Url $Site.URL -Owners $SiteCollAdmin
    Write-Host -f Green "Added Site Collection Admin to: "$Site.URL
}
This PowerShell script only Adds given user as additional site collection administrators. Existing administrators will stay!

To remove OneDrive Site collection Admin, use: How to Remove Site Collection Administrator from OneDrive?

How do I access deleted user’s OneDrive for Business?

Deleted user’s OneDrive sites are retained for 30 days or for the number of days configured in the OneDrive retention policy. You can restore deleted OneDrive sites using Restore-SPODeletedSite cmdlet in PowerShell.
More info: Restore OneDrive for Business Site

How do I give access to OneDrive outside my organization?

External user access should be enabled at the tenant and site levels to provide access to OneDrive files and Folders. You can use either SharePoint Admin center or PowerShell to achieve the same.
More info: OneDrive for Business Guest Access

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

5 thoughts on “How to Grant Access to another User’s OneDrive for Business Site in Office 365?

  • Are we able to set Grant Admin Access to All OneDrive for Business Site Collections script for a security group instead of a single user account?

    Set-SPOUser -Site $Site.Url -LoginName $SiteCollAdmin -IsSiteCollectionAdmin $True

    Thank you.

    Reply
  • First of all, thanks for this contribuition, it helped me a lot, awesome work!!

    Tested the one that would change for all sites and seemed to work, but I wonder, how could I use for example the first one that is meant to add to only one specific onedrive site, but instead I use it to multiples sites? is there a way to like, I add 4 or 5 specific sites in there, rather than run it individually for each site?

    Thanks!

    Reply
  • How can you modify this script to automate adding a user’s manager as secondary admin to only a list (.CSV file) of OneDrives

    Reply
  • How do I add O365 Group as secondary admin? The O365 group shows as ” member” in sharepoint GUI…

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *