We recently had to move our CeledonPartners.com domain from one Office 365 subscription to another. During this process, we were unable to remove the domain from our old account, and thus were unable to add it to our new account.
This was obviously frustrating and the error, while initially useful, became ever more frustrating as the night went on:
Unable to remove domain
- There are user accounts that are associated with this domain.
- There are email accounts or Microsoft Lync Online accounts that are using this domain.
As the error suggested, you can not remove a domain while it is “in use”. I went through every user account and group and removed any email addresses and usernames that were still using @celedonpartners.com. Unfortunately the error persisted. I then moved to PowerShell and ran the steps described in this KB article. Unfortunately that didn’t work either.
I then wasted an hour looking at all the other places the domain might be being using. The Sharepoint configuration, the account default settings, etc. You can read all about them at the following KB articles:
- 2787250 “Domain is the primary/default domain” or “You cannot delete the default domain” error when you try to remove a domain from Office 365
- 2787264 “Cannot Remove Domain” error when you try to remove a domain from Office 365
- 2787210 “Unable to remove (this) domain” error when you try to remove a domain from Office 365
- 2787792 “Domain has associated subdomains” or “You cannot remove a domain that has subdomains” error when you try to remove a domain from Office 365
- 2787317 The “Remove” domain link is unavailable or “You cannot remove the initial domain” error when you try to remove a domain from Office 365
I eventually stumbled upon the fact that I had a deleted user that was still pending full delete. Unfortunately, the steps described in the first KB article were missing the special command you need to “also include delete pending accounts”.
Connect-MsolService Get-MsolUser -ReturnDeletedUsers -DomainName contoso.com | fl UserPrincipalName
Once you add the “ReturnDeletedUsers” option, you might find your offending user that is blocking the domain removal.
For steps on how to remove this user, check out this post.