Unable to remove domain name even without dependencies

Bram - Imaxx 0 Reputation points
2024-03-06T08:41:45.41+00:00

I am unable to remove domain name in O365 portal even without dependencies

Schermafbeelding 2024-03-06 094055

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,171 questions
Microsoft 365 and Office Install, redeem, activate For business Windows
{count} votes

2 answers

Sort by: Most helpful
  1. JayceYang 1,571 Reputation points Moderator
    2024-03-07T02:37:32.61+00:00

    First, you can check if there are still some dependencies preventing the removal of domains via Powershell as mentioned in the official documentation:

    Unable to remove this domain when remove a domain from Microsoft 365 - Microsoft 365 | Microsoft Learn

    Step 1: Check whether user names contain the domain name Step 2: Check email addresses

    If the problem persists after the above checks, could you please translate the error message into English? I can’t translate the error in your screenshot. Also, please hide private information.


  2. Sandeep G-MSFT 20,906 Reputation points Microsoft Employee Moderator
    2024-03-08T09:10:50.9633333+00:00

    @Bram - Imaxx

    Thank you for posting this in Microsoft Q&A.

    As I understand you are unable to remove a domain your tenant.

    To delete a custom domain name, you must first ensure that no resources in your organization rely on the domain name. You can't delete a domain name from your organization if:

    • Any user has a user name, email address, or proxy address that includes the domain name.
    • Any group has an email address or proxy address that includes the domain name.
    • Any application in your Azure AD has an app ID URI that includes the domain name.

    You can try to run below commands to check if there are any dependencies which are stuck in your tenant,

    • Open PowerShell as administrator.
    • Run command "Connect-MsolService". Enter the global admin credentials once you are prompted to enter.
    • Now run below commands one by one and check the output. Below command will give you results of users groups and contacts which are using your domain name which you are trying to delete.

    For users:

    • Get-MsolUser -All | where {$_.userPrincipalName -like "*@Domainname"}
    • Get-MsolUser -All | where {$_.proxyAddresses -like "*******@totalworkplace.onmicrosoft.com"}|
    • Get-MsolUser -All | where {$_.mail -like "*@Domainname"}

    Get-MsolUser -All | where {$_.targetAddress -like "*@Domainname"}| fl > c:\user-targetaddress.txt

     

    For Groups:

    • Get-MsolGroup -All | where {$_.proxyAddresses -like "*@Domainname"}
    • Get-MsolGroup -All | where {$_.mail -like "*@Domainname"}
    • Get-MsolGroup -All | where {$_.targetAddress -like "*@Domainname"}

     

    For Contacts:

    • Get-MsolContact -All | where {$_.proxyAddresses -like "*@Domainname"}
    • Get-MsolContact -All | where {$_.mail -like "*@Domainname"}
    • Get-MsolContact -All | where {$_.targetAddress -like "*@Domainname"}

    Let me know if you have any further questions.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.