When a user’s User Principal Name is changed in Microsoft 365 — for example after a marriage, a rebranding, or a domain migration — OneDrive may continue to use the old profile path. This mismatch causes OneDrive to show a sync error, fail to open files, or create a second profile folder. The root cause is that OneDrive caches the original UPN in its local configuration and does not automatically update the local profile folder name. This article explains exactly why the path mismatch occurs and provides the step-by-step fix to align the local OneDrive folder with the new UPN.
Key Takeaways: Fixing OneDrive Profile Path After a UPN Change
- OneDrive Settings > Account > Unlink this PC: Removes the cached old UPN and allows OneDrive to re-detect the new UPN on next sign-in.
- %LocalAppData%\Microsoft\OneDrive\settings\Business1: Location of the cached UPN value that must be cleared before unlinking.
- Known Folder Move reconfiguration: Required after unlinking to reconnect Desktop, Documents, and Pictures to the new profile path.
Why the OneDrive Profile Path Stays on the Old UPN
OneDrive for Business stores the user profile folder path based on the UPN that was active during the initial setup. The path is typically C:\Users\[username]\[company name] where [company name] is derived from the domain part of the original UPN. When the UPN changes — for example from jane.doe@oldcompany.com to jane.doe@newcompany.com — OneDrive does not automatically rename the local folder or update the registry entries that reference it.
The mismatch appears because the OneDrive sync engine checks the UPN stored in the registry at HKEY_CURRENT_USER\Software\Microsoft\OneDrive\Accounts\Business1 against the current UPN from Azure AD. When these do not match, OneDrive either shows a sync error or creates a second profile folder with the new UPN while leaving the old folder orphaned. This behavior is by design: OneDrive prioritizes data integrity over automatic folder renaming, which could break file references in other applications.
Registry Entries That Hold the Old UPN
Two registry keys must be cleared to fully reset the cached UPN:
- HKCU\Software\Microsoft\OneDrive\Accounts\Business1\UserEmail: Stores the old UPN directly.
- HKCU\Software\Microsoft\OneDrive\Accounts\Business1\TenantId: Although the tenant ID rarely changes, a UPN change across domains in the same tenant may still cause a mismatch if the old tenant ID is cached incorrectly.
Clearing these entries and unlinking OneDrive forces the client to re-authenticate and re-create the profile path using the new UPN.
Steps to Align the OneDrive Profile Path With the New UPN
Follow these steps in order. Do not skip the registry cleanup step — simply unlinking without clearing the cached UPN may not resolve the mismatch.
- Close all Office apps and OneDrive
Right-click the OneDrive icon in the system tray and select Pause syncing. Then right-click again and select Settings. On the Account tab, click Unlink this PC. Do not confirm the unlinking yet — leave the dialog open. - Open Registry Editor and navigate to the OneDrive account key
Press Windows + R, typeregedit, and press Enter. Go toHKEY_CURRENT_USER\Software\Microsoft\OneDrive\Accounts\Business1. If you see more than one subkey (Business2, etc.), check each one for the UserEmail value that matches the old UPN. - Delete the UserEmail value
Right-click the UserEmail string value and select Delete. Confirm the deletion. Do not delete the entire Business1 key — only the UserEmail value. Close Registry Editor. - Confirm the unlink in the OneDrive dialog
Go back to the OneDrive Settings dialog and click Unlink this PC. When prompted, click Unlink account. OneDrive will close. - Restart OneDrive and sign in with the new UPN
Open OneDrive from the Start menu or by searching for OneDrive. Enter the new UPN (e.g.,jane.doe@newcompany.com) and click Sign in. Complete the authentication flow. OneDrive will create a new profile folder using the new UPN. - Move or link existing files from the old folder
If you have files in the old OneDrive folder (the one with the old UPN in the path), copy them to the new folder. Use File Explorer to navigate toC:\Users\[your username]and drag the contents of the old folder into the new OneDrive folder. Allow the sync to upload the files. - Reconfigure Known Folder Move
Right-click the OneDrive icon in the system tray, select Settings, go to the Sync and backup tab, and click Manage backup. Select the folders you want to protect (Desktop, Documents, Pictures) and click Start backup. This links the known folders to the new profile path.
If OneDrive Still Shows the Old Profile Path
OneDrive creates a second profile folder instead of renaming the old one
This is normal. OneDrive never renames an existing profile folder. Instead, it creates a new folder with the new UPN. After completing the steps above, you must manually move your files from the old folder to the new one. Do not delete the old folder until you confirm that all files have synced to the new folder and are visible in the OneDrive web portal.
OneDrive shows error 0x8004de40 after UPN change
This error indicates that the cached credentials in Credential Manager still reference the old UPN. Open Control Panel > User Accounts > Credential Manager > Windows Credentials. Look for any entries that contain OneDrive Cached Credential or the old UPN. Remove those entries, then restart OneDrive and sign in again.
OneDrive for Business stops syncing after a domain migration
If the UPN change was part of a domain migration (e.g., from @olddomain.com to @newdomain.com), the tenant ID remains the same, but the sync token may be invalidated. In addition to the steps above, run the OneDrive sync reset command: press Windows + R, type %localappdata%\Microsoft\OneDrive\OneDrive.exe /reset, and press Enter. Wait 60 seconds, then open OneDrive again. This clears the sync token without affecting local files.
OneDrive Profile Path vs OneDrive Sync Root: Key Differences
| Item | OneDrive Profile Path | OneDrive Sync Root |
|---|---|---|
| Description | The local folder path that contains the user’s OneDrive files, derived from the UPN at initial setup | The root folder in the cloud (e.g., https://tenant-my.sharepoint.com/personal/user_domain_com) |
| Changes after UPN update | Does not change automatically; requires manual unlinking and re-authentication | Changes automatically within 24 hours after the UPN is updated in Microsoft 365 admin center |
| Location in registry | HKCU\Software\Microsoft\OneDrive\Accounts\Business1\UserEmail |
Not stored locally; resolved via Azure AD during sign-in |
| Impact on sync | Mismatch causes sync errors or duplicate folders | No direct impact; the cloud root always points to the correct user site |
The profile path is a local convenience for file storage. The sync root is the authoritative cloud location. After a UPN change, the sync root updates automatically, but the local profile path must be fixed manually using the steps in this article.
You can now align the OneDrive profile path with the new UPN by unlinking, clearing the cached UserEmail registry value, and re-signing in with the updated credentials. Next, verify that all files sync correctly by checking the OneDrive activity center. As an advanced tip, use the OneDrive for Business Group Policy Administrative Template to set the Silently sign in users to the OneDrive sync app with their Windows credentials policy, which can reduce UPN-related mismatches in hybrid joined environments.