"Domain has associated subdomains" when removing a domain from Microsoft 365
Problem
If you try to remove a domain from Microsoft 365, you experience one or both of the following symptoms:
When you try to remove the domain through the Microsoft 365 portal, you receive the following error message:
Domain has associated subdomains.
When you try to remove the domain by using Windows PowerShell, you receive the following error message:
Remove-MsolDomain : You cannot remove a domain that has subdomains. You must first delete the subdomains before you can remove this domain.
At line:1 char:18
+Remove-MsolDomain <<<< -DomainName <DomainName>
+CategoryInfo : OperationStopped: (:) [Remove-MsolDomain], MicrosoftOnlineException
+FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.DomainHasChildDomainException,Microsoft.Online.Administration.Automation. RemoveDomain
This issue occurs if the domain has associated subdomains.
Note
Azure AD and MSOnline PowerShell modules are deprecated as of March 30, 2024. To learn more, read the deprecation update. After this date, support for these modules are limited to migration assistance to Microsoft Graph PowerShell SDK and security fixes. The deprecated modules will continue to function through March, 30 2025.
We recommend migrating to Microsoft Graph PowerShell to interact with Microsoft Entra ID (formerly Azure AD). For common migration questions, refer to the Migration FAQ. Note: Versions 1.0.x of MSOnline may experience disruption after June 30, 2024.
Solution
To fix this issue, remove all subdomains that contain the domain that you're trying to delete.
For example, consider the following scenario:
- You have two domains:
www.contoso.com
andcontoso.com
. - You want to remove the
contoso.com
domain.
In this scenario, you must also remove the http://www.contoso.com
subdomain to remove the contoso.com
domain.
More information
For more information, see You get an error message when you try to remove a domain from Microsoft 365.
Still need help? Go to Microsoft Community.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for