Recently I was working on user’s migration from one domain to another. Therefore, to migrate the users over to the new domain, I simply logged on to Microsoft 365 admin center and updated users User principal Name (UPN) to the new one.
UPN in Microsoft 365 is used by users to sign in on their devices and can be different from email address. However, In my case, both UPN and email address of the user is same for simplicity.
For example: Users old UPN was xyz@cloudinfra.net which was changed to xyz@myotherdomain.com. Both these domains are verified domain in the same Microsoft 365 tenant.
This change of primary email address and UPN takes some could of hours to propagate in the backend. When you change user’s UPN, their Primary SMTP email address will change automatically to match with user’s UPN.
You can then request user to re-configure Outook, Microsoft 365 apps like Word, Excel etc. and also request the user to re-configure Onedrive.
The change will work well on all other Microsoft 365 apps except Onedrive. As I was reconfiguring this on user’s device, I noticed that Onedrive could not be setup with User’s new UPN address.
I got the error message: Your OneDrive has not been setup. For help, contact your IT department (Error code: 0x8004e4f1). You may also receive an error message the There was a problem connecting to OneDrive. Check your Internet connection, and then try again later. (Error Code: 0x8004deed)

There is no straight solution for this issue, however we can take few different approaches to troubleshoot this issue. User’s One drive URL is based on user’s UPN and the URL changes when you change user’s UPN.
Its recommended to make the UPN changes on Friday End of business day so that it could propagate the changes in the backend over the weekend and users do not get any issues.
If you are still facing issues in OneDrive setup using the new UPN, please follow below troubleshooting steps:
Please make sure to take back up of unsynced / unsaved files before proceeding as troubleshooting onedrive could result in data loss if you have unsaved work. |
Clear Onedrive cache from Credential Manager
First thing you could do is to clear OneDrive credential cache on your Windows device using credential manager. This is saved OneDrive credentials which are used for sign in on the OneDrive application. This could show the old credentials, before moving over to the new UPN. Let’s check the steps:
- Login on Windows device and click on Start.
- Search for Credential Manager.

- Go to Windows credentials and search for OneDrive cookie / cached credentials. Click on Remove to delete the credentials from your device.

Unlink OneDrive from the PC and re-login
Next, you can try to unlink OneDrive from OneDrive settings which will present you with the option to re-login on it using new UPN of the user.
- Go to Onedrive in system tray and then click on Settings icon.

- Click on Account > Unlink this PC.

- Click on Unlink account button on the option “Unlink account on this PC?“. It says Your business content associated with account <account name> will stop syncing. Locally available files will remain on this device while online only files will be removed.

- Sign in on OneDrive now with new UPN address provided by the administrator. Click on Sign in button to proceed.

- As you can see we just signed in using the new UPN address for this user successfully.

Reset OneDrive application
If there are still issues with logging on to OneDrive application and you still get the Onedrive setup error. Then you can try to reset the application using below steps:
- Launch Powershell or command prompt as an administrator.
- Navigate to C:\Program Files\Microsoft OneDrive where OneDrive app is Installed.
- Type the command
Onedrive.exe /reset
to reset this application.
You may get an error message at this stage the OneDrive can’t be run using full administrator rights. Please restart OneDrive without administrator rights. This means that Onedrive could not be started automatically, you can start onedrive application as a normal user.

Re-link the User’s UPN using Powershell
You could also try to re-link or update / refresh user’s UPN to the new UPN by using below Powershell cmdlets. Please note that any change in Microsoft 365 user account could take couple of hours to propagate. I would suggest to give at least 24 hours before trying again.
#Install ExchangeOnline Powershell Module
Install-Module -Name ExchangeOnlineManagement
#Connect to Exchange Online
Connect-ExchangeOnline
#Refresh User's UPN to New UPN
Set-MsolUserPrincipalName -UserPrincipalName "jatin.makhija@cloudinfra.net" -NewUserPrincipalName "jatin.makhija@newdomainname.com"
Download latest version of OneDrive and re-Install
You can also try to uninstall the Old versin of OneDrive and upgrade it to the latest version which will have all the bug fixes along with latest features. To Download the latest version you can use the link: https://www.microsoft.com/en-gb/microsoft-365/onedrive/download.
Raise a Support Ticket with Microsoft
If there are still issues with OneDrive and its not setting up for the users. Then you can also raise a support ticket with Microsoft from Microsoft 365 admin center. For creating a ticket for Microsoft support use below steps:
- Login on Microsoft 365 admin center.
- Go Support link on the left hand side menu> New Service request.
- Provide Information on How can we help ? pane and create a ticket from there.
Conclusion
In this blog post, we have looked in to different approaches we can take to troubleshoot Onedrive setup issue. There is no easy way and even though its a known issue we still don’t know the exact cause of it. This is generally seen when you switch user’s UPN which could affect Onedrive.
Normally leaving the change and letting it propagrate for 24 hours tend to resolve this issue itself. If its still not resolved, then you could take the troubelshooting steps given in this blog post.
READ NEXT
- Connect-SPOService : Current Site Is Not A Tenant Administration Site.
- Audit Disabled User Accounts In Microsoft 365.
- Bypass Spam Filtering For An Email Address Or Domain In Office 365.
- Block Emails Based On File Attachment Extension In Office 365.
- How To Integrate Azure DevOps Pipelines With Slack Channel.cloudinfra.net)