How to Apply Impersonation for OneDrive: Complete Tutorial
Download & then install SharePoint Online Management Shell from MS Windows Download Center to Windows Computer via PowerShell, and then download AdminRights.ps1 script in the same system in which SharePoint Online Management Shell is pre-installed.
In addition to it, after completely downloading and installing SharePoint Online Management Shell, follow the steps described in the article. For OneDrive Migration or user account backup, you need to create new service accounts with the Admin Privileges, and then assign SharePoint Site Account Connection Admin Privileges to it or you can use your old account but it should have admin rights.
Step 1: Create New Service Account with Admin Privileges
- First of all, login to O365 Management Panel by an account with the Admin Privileges and Click on Sign-in button.
- Then click Users & Select “Add a User”
- In details page, enter all details for new service account and then click Add
- In Settings Page, choose Yes for assigning Admin Permissions and from the drop-down menu, choose Global Admin. Additionally, the users can even add an alternate mail address & location and select Next.
- In send results in mail page, click on Create Button. The service account information can’t be sent to Admin
- For activating the account, log in to Office 365 Management Panel via a new Service Account and update its password
Step 2: Configure Impersonation for OneDrive
Note: Make use of this step for configuring permission for the current users.
There are only two options that can be used for giving service account created in Step 1. Then make New Service Account access to the users’ accounts:
It provides two provisions for solving the purpose:
Provision 1: Run the SharePoint Online Management Shell script for applying for the proper permissions automatically for each user accounts, it can be preferred and fastest. In case of the multiple users, this can be the easiest method.
Provision 2: Configure the users account from Microsoft SharePoint Admin Center manually and in case you have only few users, it is completely an easy method.
Let’s get it clear now by going through two options:
Provision 1 : Assign Permission with SharePoint Online Management Shell Script
1. Configure Permission via SharePoint Online Management Shell Script
2. Download & open admin rights.ps1 script in a text editor i.e., Notepad
3. Browse and edit the following four variables:
Note: It is mandatory to fill all the four options to run SharePoint Online Management Shell script.
The domain name which you have entered while Logging in to o365 is to be used in the “AdminURL” & in “MyURL” as well.
$o365login: Replace Office 365 service account or administrator account username.
$o365pw: Replace Office 365 service account or administrator account password.
$spAdminURL: Replace the same URL used in organization’s OneDrive URL, but suffixed with-admin
$spMyURL: Replace the same URL used in organizations’ OneDrive URL, but suffixed with –my
4. First of all, save and close the entire script
5. Locate SharePoint Online Management Shell installed in first step and right click and run it as Administrator
6. If you will not run SharePoint Online Management Shell script as Admin then you will encounter an error “Set-ExecutionPolicy : Access to the registry key
‘HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell’ is denied.”
Thus, it is always recommended to run SharePoint Online Management Shell with Admin rights.
7. In the next step, change the working directory in the SharePoint Online Management Shell to a location where you have stored AdminRights.ps1 script:
8. Run the command listed below:
Set-ExecutionPolicy Unrestricted
9. After this, An option will be displayed asking “Do you want to change the execution policy?”. Enter Y to continue.
10. Run the command for AdminRight.ps1 script:
.\AdminRights.ps1
11. Hit Enter for completely exiting the script
12. Finally, exit the SharePoint Online Management Shell
Provision 2 : Assign Permissions from Admin Center of MS Sharepoint
1. First of all, login to O365 Management Panel with Service Account Credentials
2. Then Go to Admin Center & Select Sharepoint
3. Then, Click on User Profiles
4. Then Click on Manage User Profiles.
5. Within Find Profiles field Type the Name of Account & click on Find
6. Now Click on User Account Name & Select on Manage Site Collection Owners
7. Now Site Collection Owner Window is displayed, within site collection Administrator field, add Service Account with Administrative Privilege. Enter The Username & Click on “Check User” icon
Or Using, Directory Icon to Select Account from Directory
8. Finally, Search within the Directory & Click on OK
Conclusion
The above listed manual method to manage OneDrive impersonation for business permissions will help you to perform it solely. Hence, keep connected to the entire write-up and follow the process thoroughly.