This article explains how to resolve the BadRequest
error that occurs when a user's OneDrive for Business site has not yet been created in Microsoft 365.
1. Symptom
When migrating files to a user's OneDrive, the migration fails for that user. The migration logs display the following error message:
Failed: Message is: Destination: Code: BadRequest Message: Unable to retrieve user's mysite URL. Inner error
2. Cause
This error is sent directly from the Microsoft 365 API. It means that CloudM Migrate attempted to connect to the destination user's personal OneDrive site to write data, but the site does not exist yet.
In Microsoft 365, a user's OneDrive for Business site is not automatically created when a license is assigned. The creation process, known as provisioning, is typically triggered the first time a user logs in and accesses their OneDrive. Until this one-time process is complete, the user's personal site URL (mysite URL
) does not exist, and the API call to access it will fail.
3. Resolution
To fix this, the user's OneDrive site must be provisioned. This can be done individually by the user or in bulk by an administrator.
Option 1: Manual Provisioning by the User (Single User Fix)
This is the simplest method for resolving the issue for an individual user.
-
Ask the affected user to open a web browser and sign in to the Microsoft 365 portal at https://www.office.com.
-
Instruct them to click on the OneDrive icon from the app launcher on the left.
-
This action will initiate the provisioning process for their personal OneDrive site. It may take several minutes to complete.
-
Once the user can see their (likely empty) OneDrive file library, the site has been successfully created.
-
You can now re-run the migration for this user in CloudM Migrate.
Option 2: Pre-Provisioning in Bulk (Administrator Recommended)
For migrating multiple users, it is highly recommended that an administrator proactively provisions all OneDrive sites before starting the migration project. This prevents the error from occurring for each user individually.
This is done by running a PowerShell script against your Microsoft 365 tenant.
-
Gather a list of all user principal names (UPNs) that you intend to migrate.
-
Use the PowerShell script and instructions provided by Microsoft in their official documentation to create the sites in bulk.
For the complete script and detailed instructions, refer to the official guide: Pre-provision OneDrive for users in your organization - Microsoft Docs
Best Practice: Proactively pre-provisioning all required OneDrive sites is a critical prerequisite for any large-scale OneDrive migration project.