Kernel Data Recovery Blog

How to remove a domain from Microsoft Office 365?

Read time 6 minutes

A domain name is a unique identifying address that appears along with @ in the email address. As a web address, it appears with www. Typically, the domain name takes the form of an organization or university and appears as companyname.com and universityname.edu and all the Office 365 users have at least one domain attached to their accounts.

But sometimes, when the user has multiple domains in a single Office 365 account, then he/she needs to remove some domains when they are consolidating their subscriptions, or changing or canceling their subscriptions. And we are going to show the procedure in the article.

You cannot remove the domain instantly, but multiple steps are required for the complete removal of a domain from the account.

NOTE: You cannot delete the onmicrosoft.com domain from the account.

Stage 1: Move the users to another domain.

First, you need to disenfranchise the user from the domain by changing their domains. Here are the steps;

  1. Go to Office 365 Admin Center and go to Active Users in the Users category.
  2. Choose the user account whose domain you want to change. Click More option (…) and choose Manage username and email.
  3. Click the Edit icon to change the domain name.
  4. Use the dropdown menu and select the new domain address for the account. Click Done.
  5. At the Change Domains page, choose a different domain.

Stage 2: Move the groups to another domain.

  1. In the Office 365 Admin Center, follow Groups>>Groups page.
  2. Choose the Group and click Edit Email Address.
  3. Click the Edit icon in front of Primary email address.
  4. Choose a different domain address from the drop-down and click Done.

Stage 3: Remove the old domain.

  1. In the Office 365 Admin Center, click Settings>>Domains page.
  2. Choose the domain, click the option in front of it and click Remove domain.
  3. Click Remove.
  4. Follow the instructions and finally, click Close.

It will take up to 5 minutes for the complete deletion of the domain from Office 365 if it is not associated with multiple places such as groups, security groups, users, distribution lists, etc. In this case, it may take many hours for the complete deletion of the domain.

Remove multiple users from the domain

If you want to delete multiple users from the domain, then you should use the Exchange Management Shell cmdlets to delete the multiple domains.

  1. First, start the Exchange Management Shell as the Administrator. Then you need to install the Exchange Online Module at the management shell.
    Install-Module MSOnline

    It will ask you to validate your given command. Click Yes.

  2. Import the Exchange Online module.
    Import-Module MSOnline

    It will ask you to import the credentials of your Exchange account before starting the removal of the domain. Input the credentials.

  3. Run the command;
    Get-MSOLUser | Where-Object { $_.UserPrincipalName –like “*johnlabs.com”}

    The command will enlist all the users who are associated with the johnlabs.com domain name.

  4. Run the command;
    Get-MSOLUser | Where-Object { $_.UserPrincipalName –like “*johnlabs.com”} | Remove-Msoluser

    The command will first enlist all the users and then delete them one by one. You will need to click Y for every user.

After all the users are deleted from the domain, then you can go to Office 365 Admin Center, find the Domain in the Domains category. Select the domain and click Remove.

Limitations

The first method is limited for the removal of a single user from the whole domain and it takes time to remove the multiple users one by one. Whereas the second method removes the whole accounts together. It is advisable to migrate all your emails and other data from your mailboxes before removing the domain from it. For this you can try a professional third party tool.

Third party solution for migration

Kernel Office 365 Migration tool is one of the most trusted tool to supports the migration of the mailbox data for a single as well as multiple mailboxes. It supports all Office 365 subscription plans.

You will be able to migrate all your data from the mailbox, archive mailbox, and public folder. For a smooth migration, you will also get multiple filter options to exclude the unrequired data; and after the migration, you will be able to get a complete migration report. So, if you are planning to remove a domain from Office 365, then you should use this tool to migrate all your Office 365 data and remove the domain name. Your data will be saved in a different account where you can access them. You can also migrate data from one Office 365 tenant to another.