can't remove custom domain from AAD - Microsoft.Online.Workflows.DomainDeletionException

Richard Hauer 1 Reputation point
2023-04-24T07:17:55.3166667+00:00

Trying to delete a custom domain I added as an experiment only a few days ago. The domain is not primary, and the AAD is just a backing store for B2C. I need to move the custom domain to another B2C so really need to delete it. I'm just getting "Unable to delete domain name" with the message "Unable to delete domain name 'xxxxxx' from NNNNNNN" and the code is "Request_BadRequest". There's no services attached or users or anything - I've just no idea why. Same errors through PowerShell. Anyone have any ideas where to look?

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

1 answer

Sort by: Most helpful
  1. JamesTran-MSFT 37,226 Reputation points Microsoft Employee Moderator
    2023-04-24T21:44:48.69+00:00

    @Richard Hauer Thank you for your post!

    Error Message: 
    Unable to delete domain name '<Domain Name>` from '<Azure AD Tenant Name>'
    
    Code: 
    Request_BadRequest
    

    I understand that you're trying to delete a custom domain that you added a few days ago for experimental/lab purposes. However, when trying to delete the custom domain you're running into the above error message and error code.

    Depending on the custom domain name you're trying to delete - if this is a onmicrosoft.com domain, unfortunately you won't be able to rename or remove this domain.

    • Note: If the domain name you're trying to delete isn't an onmicrosoft.com domain, can you share a screenshot of the error message you're receiving, or the domain name you're trying to delete?

    User's image

    For more info - Why do I have an "onmicrosoft.com" domain?

    If you want to have your email look like ******@contoso.com: buy the domain or just follow the steps in Add your users and domain to Microsoft 365 if you own it already.

    You can replace your onmicrosoft.com domain after sign-up. While you can’t rename or remove an existing onmicrosoft.com domain, you can create a new one and make it your default onmicrosoft.com domain (your “fallback domain”). For example, if the initial domain you chose was fourthcoffee.onmicrosoft.com, if needed you can create a new onmicrosoft.com domain called fourthcoffeecorp.onmicrosoft.com and set it to be your fallback domain.

    You might not be able to change your SharePoint domain name. Your SharePoint domain name is based on your onmicrosoft.com domain name. The ability to change the SharePoint domain name is available in public preview for organizations whose total SharePoint sites and OneDrive accounts number fewer than 1000.

    You can't remove your onmicrosoft.com domain. Microsoft 365 needs to keep it around because it's used behind the scenes for your subscription. But you don't have to use the domain yourself after you've added a custom domain. If you choose to create a new onmicrosoft.com domain, it cannot be removed. You are limited to five onmicrosoft.com domains in your Microsoft 365 environment, so make sure to check for spelling and to assess your need if you choose to create a new one.

    I hope this helps!

    If you have any other questions, please let me know. Thank you for your time and patience throughout this issue.


    Additional Links:


    If the information helped address your question, please Accept the answer. This will help us and also improve searchability for others in the community who might be researching similar information.


Your answer

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