Removing domains in Office 365


The process to remove a domain may not be that simple, especially when the desired domain had some replication going on which is the case of the scenario that we are working on this article here at

In order to remove a domain in Office 365, logged as administrator in the Office 365 Admin Center, click on Setup and then Domains. A list of all domains added to the subscriptions will be listed, click the desired domain (in our case
A blade with the DNS requirements for the domain will be displayed. In our case, we just want to remove, so click on Remove.


Office 365 is easy to manage and the intelligence behind helps the administrator to accomplish his objectives fast. A good example is when removing a domain, the wizard will not allow a removal if there are any dependencies such as user and other resources (Exchange/Skype for Business) attached to the given domain.

Also, besides of informing that there is a dependency with the domain that we want to remove a list of dependency will be listed and they will be separated in sections as depicted in the image below. By doing that, the wizard points the administrator to the right directon and save lots of time to complete the task. We can save that information and fix those users listed before coming back to remove the domain.


Well, at this point in the game we know for a fact that the domain that we are trying to remove have some dependencies. The easy way is to go to the users in Office 365 and remove them, right? Well, that works if such objects had not been synchronized between on-premises and Office 365.

In order to check, click on Users, then Active Users. Select a user that has (which is the domain that we are planning to remove). In the new blade, click on Delete user, a new blade requiring confirmation will be displayed, click on Delete.


For our surprise the user cannot be deleted because it had been synchronized previously between the on-premises and the Office 365, as informed on the image below.

If the synchronization is working properly, then the best practice is to remove the user from on-premises and wait for the replication, repeat that step for all accounts and then the domain can be removed.


Removing an Office 365 domain the hard way…

We should cover all scenarios. Let’s assume that this tenant had the synchronization in place, but it was discontinued and we can’t restore the synchronization to its glory.

A good example happened to me when writing this article (the original idea of this article was to manage Office 365 domains), but I had such a hard time to remove a domain from an old subscription that I used for testing that I decided to focus just on the removal process.

If you are in this situation, the best way is using our old good friend PowerShell to remove the objects, and then return to the Office 365 Admin Console to remove the domain.

The first step is to install the Microsoft Online module in PowerShell, we can do that by using the following command line and hitting Y when requested.

Install-Module MSOnline


The second step, is to import the module that we have just installed using the cmdlet below. To check the load modules, we can use Get-Module cmdlet.

Import-Module MSOnline

After importing the module, we need to connect to the service, we will use the Connect-MSOLService cmdlet and fill out the credentials.


We know for a fact that we had synchronization going between that subscription and our on-premises environment, and we can check if it is still enabled running the following cmdlet.

Get-MSOLCompanyInformation | Select DirectorySynchronizationEnabled

Before starting the process to remove the objects, we need to stop the synchronization configuration. We can do that by running the following cmdlet, and we can repeat the previous cmdlet to check the change on the status of the replication.

Set-MSOLDirSyncEnabled –EnableDirSync $False


When running Get-MSOLUser cmdlet we will have a list of all users of the subscription, we can check that there are some using the domain that we want to remove and some using the default domain which ends with

We want to check all accounts that are using the domain that we are planning to remove, and to do that we can use the following cmdlet.

Get-MSOLUser | Where-Object { $_.UserPrincipalName –like “*” }



We can remove those accounts using Office 365 Admin Center, or PowerShell, an easy way using PowerShell is adding | Remove-MSOLUser to the end of the previous cmdlet and that will start deleting those accounts associated to the domain (a confirmation will be required).


At this point in the game, we don’t have more objects associated to the domain, so we can go back to the Office 365 Admin Center, click on Setup, and then Domains. Click on the domain, and on the new blade, click on Remove.

Now, the experience will be different, the wizard will check and no dependency will be listed because we took care in the previous steps, just click Remove, and the result will be the message bar informing that Domain was successfully removed, click Close.


One last note before we conclude this article, if you are an ITPRO or enthusiast that has several subscriptions and some of them expired, and your domain got stuck in one of them, the best approach to find where your domain is through a simple ticket in Office 365. Just open a ticket and inform them that you want to validate your domain (you must be the owner of such domain for obvious reasons) and you would like to know which subscription that domain is currently associated and they will inform you.

3 thoughts on “Removing domains in Office 365”

  1. How would you recover that domain if you shouldn’t have deleted it? ANy help will be greatly appreciated. Not much info out there on it.

  2. you need to add it back in under setup>domains. if the mx records are still in place, the domain will verify and you are good. worst case is you have to reverify the domain and update mx records.

  3. What about if a want to move all the users Associated with the domain i want to remove instead of deleting them?

Leave a Comment

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top