Error when you try to delete a B2C directory in Microsoft Entra ID: Cannot delete '<contoso>'
This article describes an issue in which an error occurs when you try to delete a B2C directory in Microsoft Entra ID.
Original product version: Microsoft Entra ID
Original KB number: 3112170
Symptoms
In a Microsoft Entra 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
Cause
This problem occurs if existing B2C application service principals (for example, CPIM, Ibiza Portal, and SSPR) are blocking the deletion.
Resolution
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:
Sign in Azure portal as an administrator who has access to the Azure AD B2C directory.
Select 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.
To find the Azure AD B2C blade, select the More Services (>) button in the lower-left corner, and then search on "B2C".
Select Azure AD B2C.
Select All Settings, and then select Applications.
Delete all applications. To do this, select the application, select Properties, and then select the Delete button.
Step 2: Delete the Azure AD B2C tenant
To do this, follow these steps:
In the Azure AD B2C directory, locate and select the Microsoft Entra ID blade in the Azure portal.
On the Overview menu, select Delete Directory.
Follow the instructions in the portal.
Contact us for help
If you have questions or need help, create a support request, or ask Azure community support. You can also submit product feedback to Azure feedback community.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for