Unable to delete Azure B2C directory

Azure B2C directories are still in preview at the time of this blog post. The behavior may change in the future.

This blog post is specific to Azure B2C directories where the b2c-extensions-app has been installed. If you need general help deleting an Azure directory, please see the following article for pointers:
https://support.microsoft.com/en-us/kb/2967860

I've had a few customers hit the following error when trying to delete a B2C directory.

Cannot delete '<B2cDirectoryName>'
The following issue(s) prevented deletion of this directory:
• Directory has one or more applications that were added by a user or administrator.

NoDelB2C

When the admin browses to the Applications section of the directory, they don't see any application to delete.

Here are the instructions to delete the b2c-extensions-app that gets added to the directory when an Azure B2C directory has been configured.

First, browse to the directory in the classic portal:

  1. Click on Active Directory on the left hand ribbon
  2. Click on the little arrow next to the B2C directory

This will open that directory and show you the options.
BrowseToB2CDir

Second, expose the b2c-extensions-app and delete it.

  1. Click the Applications option along the top row.
  2. In the Show selection box, choose Applications my company owns
  3. Click the check box to the right to refresh the application list with the new selection.
  4. Finally, click the DELETE icon on the bottom ribbon. Confirm the deletion of the b2c-extensions-app.

DelB2CApp3

After the b2c-extensions-app is removed, you will be able to delete the directory.

Yay!

-Joel