In this article we’re going to give you the run down on how exactly we can grant OneDrive access to another user as an administrator of Office 365. This use case typically stems from someone who has recently left the company and the person that’s going to be taking over is requesting this access.
It happens all the time and today we’re going to document exactly what’s needed as well as how to streamline the process using Powershell.
Requirements For Granting OneDrive Permissions
In order to make this work there are a few things you’ll need as well as few things you’ll need to know so you don’t run into any road blocks. We’ll outline the 3 topics you need here.
- You’ll need either Global Administrator -or SharePoint Administrator rights
- You’ll need to know the SharePoint admin site URL to connect to it.
- Your admin site URL is typically https://<tenantName>-admin.sharepoint.com. e.g. https://thesysadminchannel-admin.sharepoint.com
- You’ll need the Microsoft.Online.SharePoint.PowerShell Module
Once we have successfully connected to SharePoint online using Powershell we can confirm our connection by typing in Get-SPOSite | select -First 5. If you know of a SharePoint site you can use that as well.
Grant OneDrive Access To Another User
At this point we’ve already connected to SharePoint Online which should now give us access to OneDrive properties and cmdlets. Let’s start by getting the general layout of how OneDrive URLs are generated. Typically, a user’s OneDrive link is going to be https://<tenantName>-my.sharepoint.com/personal/<userName>_<domainName>_<domainSpace>
The above might sound pretty confusing because of all the variables that is has, but a user in my tenant would look like this:
“https://thesysadminchannel-my.sharepoint.com/personal/bsmith_thesysadminchannel_com” – In my case, my domain and my tenant name are the same so its pretty simple, but if your tenant name and domain are different, you’ll need to account for that too. The domainSpace above refers to .com/ .net / .biz etc…
If you’re still unsure what your OneDrive URLs might look like you can go to admin.microsoft.com -> search for the user -> select the OneDrive tab and click to create a link to view the user’s OD files.
Now that we know the general layout, all we’ll need to do is populate the username in that url template. In this case, I’m going to grant myself site collection admin access to the user Gabby’s OD by running the Set-SPOUser cmdlet.
$URL = 'https://thesysadminchannel-my.sharepoint.com/personal/gabby_thesysadminchannel_com' Set-SPOUser -Site $URL -LoginName [email protected] -IsSiteCollectionAdmin: $true
We also want to verify our access by running the Get-SPOUser cmdlet.
Get-SPOUser -Site $URL -LoginName [email protected] | fl DisplayName : Paul Contreras LoginName : [email protected] IsSiteAdmin : True IsGroup : False Groups : {} UserType : Member
Conclusion
Great, now we finally know how to grant OneDrive access to another user using our administrator permissions. Hopefully you found this pretty useful and informative. If you would like to learn more, check out our OneDrive gallery that has pretty neat scripts like Get-OneDriveUsage to see how much data the user has.
Do you know if there is a way to use this method to grant Read-Only permissions to the other user, instead of full Site Admin rights? We get this request quite frequently when people leave.
thank you, I knew this can be done on GAM but now i know 0365 too.
Thank you Paul! This worked perfectly! Excellent explanation and steps.