Clean up resources and delete the tenant

When you've finished the Azure Active Directory B2C (Azure AD B2C) tutorials, you can delete the tenant you used for testing or training. To delete the tenant, you'll first need to delete all tenant resources. In this article, you'll:

  • Use the Delete tenant option to identify cleanup tasks
  • Delete tenant resources (user flows, identity providers, applications, users)
  • Delete the tenant

Identify cleanup tasks

  1. Sign in to the Azure portal with a global administrator or subscription administrator role. Use the same work or school account or the same Microsoft account that you used to sign up for Azure.

  2. Make sure you're using the directory that contains your Azure AD B2C tenant:

    1. Select the Directories + subscriptions icon in the portal toolbar.
    2. On the Portal settings | Directories + subscriptions page, find your Azure AD B2C directory in the Directory name list, and then select Switch button next to it.
  3. In the Azure portal, search for and select the Azure Active Directory service.

  4. In the left menu, under Manage, select Properties.

  5. Under Access management for Azure resources, select Yes, and then select Save.

  6. Sign out of the Azure portal and then sign back in to refresh your access.

  7. Repeat step two to make sure you're using the directory that contains your Azure AD B2C tenant.

  8. In the Azure portal, search for and select the Azure Active Directory service

  9. On the Overview page, select Manage tenants.

  10. On the Manage tenants page, select (by check marking) the tenant you want to delete, and then, at the top of the page, select the Delete button. The Required action column indicates the resources you need to remove before you can delete the tenant.

    Delete tenant tasks

Delete tenant resources

If you've the confirmation page open from the previous section, you can use the links in the Required action column to open the Azure portal pages where you can remove these resources. Or, you can remove tenant resources from within the Azure AD B2C service using the following steps.

  1. Sign in to the Azure portal with a global administrator or subscription administrator role. Use the same work or school account or the same Microsoft account that you used to sign up for Azure.

  2. Make sure you're using the directory that contains your Azure AD B2C tenant:

    1. Select the Directories + subscriptions icon in the portal toolbar.
    2. On the Portal settings | Directories + subscriptions page, find your Azure AD B2C directory in the Directory name list, and then select Switch button next to it.
  3. In the Azure portal, select the Azure AD B2C service, or search for and select Azure AD B2C.

  4. Delete all users except the admin account you're currently signed in as:

    1. Under Manage, select Users.
    2. On the All users page, select the checkbox next to each user (except the admin account you're currently signed in as).
    3. At the top of the page, select Delete user, and then select Yes when prompted.

    Delete users

  5. Delete app registrations and the b2c-extensions-app:

    1. Under Manage, select App registrations.
    2. Select the All applications tab.
    3. Select an application to open it, and then select Delete button. Repeat for all applications, including the b2c-extensions-app application.

    Delete application

  6. Delete any identity providers you configured:

    1. Under Manage, select Identity providers.
    2. Select an identity provider you configured, and then select Remove.

    Delete identity provider

  7. Delete user flows:

    1. Under Policies, select User flows.
    2. Next to each user flow, select the ellipses (...) and then select Delete.

    Delete user flows

  8. Delete policy keys:

    1. Under Policies, select Identity Experience Framework, and then select Policy keys.
    2. Next to each policy key, select the ellipses (...) and then select Delete.
  9. Delete custom policies:

    1. Under Policies, select Identity Experience Framework, and then select Custom policies.
    2. Next to each Custom policy, select the ellipses (...) and then select Delete.

Delete the tenant

Once you delete all the tenant resources, you can now delete the tenant itself:

  1. Sign in to the Azure portal with a global administrator or subscription administrator role. Use the same work or school account or the same Microsoft account that you used to sign up for Azure.

  2. Make sure you're using the directory that contains your Azure AD B2C tenant:

    1. Select the Directories + subscriptions icon in the portal toolbar.
    2. On the Portal settings | Directories + subscriptions page, find your Azure AD B2C directory in the Directory name list, and then select Switch button next to it.
  3. In the Azure portal, search for and select the Azure Active Directory service.

  4. If you haven't already granted yourself access management permissions, do the following:

    1. Under Manage, select Properties.
    2. Under Access management for Azure resources, select Yes, and then select Save.
    3. Sign out of the Azure portal and then sign back in to refresh your access, and select the Azure Active Directory service.
  5. On the Overview page, select Manage tenants.

    Screenshot of how to manage tenant for deletion.

  6. On the Manage tenants page, select (by check marking) the tenant you want to delete, and then, at the top of the page, select the Delete button

  7. Follow the on-screen instructions to complete the process.

Next steps

In this article, you learned how to:

  • Delete your tenant resources
  • Delete the tenant

Next, learn more about getting started with Azure AD B2C user flows and custom policies.