MailsDaddy Official Blog

pre-provision-onedrive-for-users

How to Pre-Provision OneDrive for Users in Organization?

Most users are not aware of how to pre-provision OneDrive for users; therefore, we will discuss it in detail here. OneDrive is automatically assigned when a user is added to the organization.

However, in some cases, organizations may have restrictions based on their subscription or policies, in which case pre-provisioning is required. This ensures that admin or organization have full control over compliance, migration support, access, and security

This is also beneficial for uses to use OneDrive with their personalized setting, no need to wait for manual creation.

Pre-provision OneDrive for Business or Personal

OneDrive is used for personal and business purposes, but provision is not for personal users. It is used for a large enterprise or organizations to access multiple users’ OneDrive accounts before they start using the service.

In other words, provisioning is used by an IT expert to handle services and configuration for an organization. So personal user does not need it as they use their own account.

How to pre-provision OneDrive for users in Microsoft 365?

The manual step to active provision is a long, time-taking and tedious task when it comes to do for 20, 50, 100 or more users. As you have to login each account one-by-one to activate it.

So, before you start, first install SharePoint Management Shell and run the following command for pre-provisioning.

Pre-requisites for provisioning OneDrive

You must be logged in with admin credentials or SharePoint admin access to pre-configure OneDrive for Business.

All users must be active, ready to login, and have an active SharePoint license.

Make sure to download and install the latest version of SharePoint Management Shell from Microsoft’s official site.

Pre-configuration of OneDrive for Users: Step-by Step

I hope you meet the pre-requisite requirements so that you can follow the further steps easily.

Create active user list in Text file

Open your notepad and type all the user account address like shown in the image and save it.

user text file

Connect to SharePoint Online to activate provisioning

Run SharePoint Management Shell as an administrator and execute the following command to connect.

Note: Use command according to your authentication: Basic and MFA

For Basic Account

Run the type your account password

Connect-SPOService -Url https://yourdomain-admin.sharepoint.com -Credential [email protected]

For MFA Account

Run and type your user account address and password

Connect-SPOService -Url https://yourdomain-admin.sharepoint.com

Use Text file for Pre-provision OneDrive

Run the following command by replacing text file location (C:\Users\mailsdaddy\Users.txt).

$users = Get-Content -path "C:\Users\mailsdaddy\Users.txt"

Request-SPOPersonalSite -UserEmails $users

In case, user is blocked to sign-in then run the following command

Get-Content -path " C:\Users\mailsdaddy\Users.txt " | ForEach-Object { Update-MgUser -UserPrincipalName $_ -BlockCredential $False }

How to setup or pre-provision OneDrive for all License Users?

The below command will work when you have the tenant id and domain name of an organization. The limit of group is 199 users, means if you have 500 users then it creates 3 batches with the fixed limit.

Param(
    [Parameter(Mandatory = $True)]
    [String]
    $SharepointURL,
    [Parameter(Mandatory = $True)]
    [String]
    $tenantID
)

$scope = 'User.Read.All'
Connect-MgGraph -TenantId $tenantId -Scopes $scope
Connect-SPOService -Url $SharepointURL;
$list = @() #list of UPN to pass to the SP command
$Totalusers = 0 #total user provisioned.

#Get licensed users
$users = Get-MgUser -Filter 'assignedLicenses/$count ne 0' -ConsistencyLevel eventual -CountVariable licensedUserCount -All -Select UserPrincipalName
foreach ($u in $users) {

    $Totalusers++
    Write-Host "$Totalusers/$($users.Count)"
    $list += $u.userprincipalname
    if ($list.Count -eq 199) {

        #We reached the limit
        Write-Host "Batch limit reached, requesting provision for the current batch"
        Request-SPOPersonalSite -UserEmails $list -NoWait
        Start-Sleep -Milliseconds 655
        $list = @()
    }
}

if ($list.Count -gt 0) {

    Request-SPOPersonalSite -UserEmails $list -NoWait
}

Disconnect-SPOService
Disconnect-MgGraph
Write-Host "Completed OneDrive Provisioning for $Totalusers users"

That’s it.

Pre-provisioning OneDrive for all license usages is an efficient way to set it up in one go. OneDrive provisioning is a must for any organization and you can do it in the manner mentioned above.

Conclusion

I have written this post to setup OneDrive for users in the organization, including benefits and snippets. If you have a large group of members in your organization, this guide helps you pre-provision OneDrive for the user in one go. Also remember to share this post with others who are looking for pre-configuration of OneDrive for users in their organization.

Also Read:

Migrate OneDrive data to Local Drive

Add User and Assign License in Office 365

Scroll to Top