You can’t delete a directory through the Azure Management Portal

Symptoms
You can’t delete a directory from the Microsoft Azure Active Directory extension through the Azure Management Portal. Additionally, you receive one of the following messages:

You are signed in as a user for whom <Your Company Name> is the home directory

Delete all users except yourself

Directory has one or more subscriptions to Microsoft Online Services.

Directory has one or more Azure subscriptions.

Directory has one or more applications.

Directory has one or more Multi-Factor Authentication providers.

Directory is a "Partner" directory.

Directory contains one or more applications that were added by a user or administrator.

Resolution
To resolve this issue, use one of the following methods, depending on the message that you receive.

Resolution for "You are signed in as a user for whom <Your Company Name> is the home directory"

Make sure that your directory has no home users, and then delete the directory. The user who deletes this directory must be a guest user, must be homed in another directory, and must be a global admin of the directory that is being deleted.

For example, your directory has the domains contoso.onmicrosoft.com and contoso.com. There must be no users who have these domains in your directory. The guest user may be a Microsoft account or may be homed from another directory such as fabrikam.onmicrosoft.com.

To learn more about how to add a guest user, go to the following Azure website:When you create this user in your directory, select one of the following:
  • A user who has an existing Microsoft account
  • A user in another Azure AD directory
This user must also be a co-admin of your Azure subscription. To learn more about how to add a co-admin, go to the following Azure website:

Resolution for "Delete all users except yourself"

Do what the message tells you to do. That is, delete all users except yourself.

Resolution for "Directory has one or more subscriptions to Microsoft Online Services."

Do you have one of the following subscriptions?
  • Office 365
  • Intune
  • Dynamics
  • Microsoft Azure Information Protection (previously known as Microsoft Azure Rights Management) 
  • Azure Active Directory Premium
If you have one of these subscriptions, contact our billing and subscriptions support team by signing in to the Microsoft cloud portal and then clicking the Support tab. Administrators can start a support request and access the Microsoft Office 365 support telephone number.Do you have one of the following subscriptions?
  • Microsoft Enterprise Mobility + Security
  • Azure Active Directory Basic
If you have one of these subscriptions, contact your Volume Licensing partner to cancel the subscription.

Resolution for "Directory has one or more Azure subscriptions"

If you have an Azure subscription, make sure that your Azure subscription is not linked to another directory. To do this, follow these steps:
  1. In the navigation pane, click Settings, and then click Subscriptions.
  2. Notice the following information:
    • Subscription
    • Account administrator
    • Directory
  3. If the directory that you are trying to delete is listed under any of the subscriptions, the account administrator has to sign in and change the directory that is associated with the subscription. To do this, the account administrator should follow these steps:
    1. On this screen, click Edit Directory.
    2. In the Edit Directory window, select the Directory list, and then change the directory.

      Note
      If no other directory is available as an option, the account administrator must be a global admin of another directory or must create a new directory.
Note You see the Edit Directory option if the account is a Microsoft account. Organizational accounts can’t change the directory. Therefore, the directory can’t be deleted.

Resolution for "Directory has one or more applications."

To learn how to remove applications from your directory, go to the following Microsoft website:

You may also have to remove additional service principals. Use Azure Active Directory Module for Windows PowerShell to remove all service principals. To do this, follow these steps:
  1. Open Azure Active Directory Module for Windows PowerShell.
  2. Connect to the Microsoft Online Service.
  3. Run the following command:
    Get-MsolServicePrincipal | Remove-MsolServicePrincipal
Note You may receive an error when you remove some service principals. These principals can’t be removed. However, this does not prevent you from deleting your directory.

The error that you receive may resemble the following:
Remove-MsolServicePrincipal : Invalid value for parameter. Parameter Name: appPrincipalId.

Resolution for "Directory has one or more Multi-Factor Authentication providers."

Remove Azure multi-factor authentication providers for your directory. For information about how do this, go to the following Microsoft website:

Resolution for "Directory is a 'Partner' directory"

Contact Microsoft Partner Support at https://mspartner.microsoft.com/en/us/Pages/Support/get-support.aspx.

Resolution for "Directory contains one or more applications that were added by a user or administrator"

To fix this issue, follow the steps in "Cannot delete" error when you try to delete a B2C directory in Azure AD.
"can not delete directory", "can't delete directory", "cannot delete directory", "can not delete tenant", "can't delete tenant", "cannot delete tenant"
Properties

Article ID: 2967860 - Last Review: 10/06/2016 23:58:00 - Revision: 13.0

Microsoft Azure Active Directory

  • kbtshoot kbexpertiseadvanced kbsurveynew KB2967860
Feedback