@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.