"Cannot delete" error when you try to delete a B2C directory in Azure AD

Applies to: Azure Active Directory


In a Microsoft Azure Active Directory environment, you set up a B2C directory, and then you try to delete it. However, you receive the following error message:
Cannot delete '<contoso>'
The following issue(s) prevent deletion of the directory:
Directory contains one or more applications that were added by a user or administrator


This problem occurs if existing B2C application service principals (for example, CPIM, Ibiza Portal, and SSPR) are blocking the deletion.


To fix this issue, use the Azure portal.

Step 1: Delete all apps that are listed on the Azure AD B2C Dashboard

To do this, follow these steps:
  1. Sign in at http://portal.azure.com as an administrator who has access to the Azure AD B2C directory.
  2. Click your display name in the upper-right corner, and then select the directory that's your B2C directory.

    Note If you have only one directory, your Azure AD B2C directory will already be selected.
  3. To find the Azure AD B2C blade, click the More Services (>) button in the lower-left corner, and then search on "B2C".
  4. Select Azure AD B2C.
  5. Click All Settings, and then click Applications.

    step 1(5)
  6. Delete all applications. To do this, select the application, click Properties, and then click the Delete button.

    Delete an app

Step 2: Delete the Azure AD B2C tenant

To do this, follow these steps:

  1. In the Azure AD B2C directory, locate and select the Azure Active Directory blade in the Azure portal.
  2. On the Overview menu, select Delete Directory.

    step 2(2)
  3. Follow the instructions in the portal.