If you remove a domain from Office 365 via the Admin Center, it simply says, “domain removal in progress” and it can sometimes take a couple HOURS for it to come back and say if it was able to successfully remove it or not. It doesn’t display anything else – no progress bar or other hint of how it’s making out. This is horrible when you need to remove the domain as a part of a project that has specific maintenance windows you need to abide by. Sometimes you simply don’t have potentially hours to wait and waste.
Fortunately, you’re able to remove a domain much faster via PowerShell and also have ways to see what is blocking the domain removal.
In our example, we want to remove the domain acme.com.
To remove acme.com from the tenant, run:
Remove-MsolDomain -DomainName acme.com -Force
It will come back right away on if it removed it successfully or not.
If it fails to remove it, run this command to see why:
Get-Msoluser -domainname acme.com
It will list which objects still have a reference to the acme.com domain. You’ll need to change or remove those references to the domain you’re trying to remove – a domain can’t be removed if there are any references to it on any objects in Office 365.
As you fix the references, you can keep running the command above. Once it comes back empty, run the Remove-MsolDomain command again and it’ll remove the domain immediately.
By the way, read my article here on a quick fix in case you’re trying to change users’ UPN to a non-vanity domain and it won’t change no matter what you try.
Jason works as a project specialist at an IT MSP in Erie, Pennsylvania, USA. He’s an IT/security professional with 20 years experience.