Read time 6 minutes

Summary: A domain name distinguishes email and web addresses in Office 365. Removing a domain entails stages for user and group migration, with duration varying based on associations. PowerShell can remove multiple users. It’s vital to backup data and consider third-party tools for streamlined data migration and tenant transfers.

A domain name serves as a distinctive identifier within an email address, denoted by the “@” symbol. In the context of a web address, it prominently features the “www” prefix. Generally, domain names adopt the structure of an institution or educational establishment, manifesting as “companyname.com” or “universityname.edu.” It’s worth noting that every Office 365 user is associated with at least one domain linked to their accounts.

Occasionally, users with multiple domains within a single Office 365 account may find it necessary to eliminate certain domains as they consolidate, modify, or terminate their subscriptions. In the forthcoming article, we will provide a detailed guide outlining the steps for this procedure.

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.
    Office 365 Admin Center
  2. Choose the user account whose domain you want to change. Click More option (…) and choose Manage username and email.
    choose Manage username and email
  3. Click the Edit icon to change the domain name.
    change the domain name
  4. Use the dropdown menu and select the new domain address for the account. Click Done.
    select the new domain address
  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.
    Groups page
  2. Choose the Group and click Edit Email Address.
    click Edit Email Address
  3. Click the Edit icon in front of Primary email address.
    Primary email address
  4. Choose a different domain address from the drop-down and click Done.
    Choose a different domain address
Stage 3: Remove the old domain.
  1. In the Office 365 Admin Center, click Settings>>Domains page.
    Domains page
  2. Choose the domain, click the option in front of it and click Remove domain.
    Remove domain
  3. Click Remove.
  4. Follow the instructions and finally, click Close.

The deletion of a domain from Office 365 typically requires up to 5 minutes to complete, provided it isn’t linked to multiple entities like groups, security groups, users, distribution lists, and so forth. However, in scenarios where the domain is associated with numerous elements, the deletion process may extend over several hours.

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 initial approach is primarily designed for the removal of individual users from the entire domain, which can be time-consuming when dealing with multiple users. In contrast, the second method allows for the simultaneous removal of entire accounts. It is strongly recommended to perform data migration, including emails and other pertinent information, from your mailboxes prior to domain removal. To facilitate this process, you may consider utilizing a reliable third-party tool for a more efficient data transfer.

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.

With this tool, you’ll have the capability to seamlessly migrate all your data, including mailbox content, archive mailbox contents, and public folder data. To ensure a streamlined migration process, you’ll have access to multiple filtering options that allow you to exclude unnecessary data. Following the migration, you’ll receive a comprehensive migration report for your reference.

If you’re contemplating the removal of a domain from Office 365, it is highly recommended to employ this tool for data migration before removing the domain name. Your data will be securely preserved in a separate account, enabling easy access. Moreover, this tool also supports data migration between different Office 365 tenants, facilitating efficient data transfer in various scenarios.