How to enable deletion of a signed-in user's account for Azure AD B2C phone sign-up/sign-in

Veli-Jussi Raitila 446 Reputation points
2023-10-03T07:39:03.7466667+00:00

What is the simplest method of enabling self-service user account deletion for Azure AD B2C phone sign-up/sign-in flow with local accounts only?

This is only for development purposes, so it can be quick-and-dirty. The solution does not need to be exposed to the end-users directly, but rather for developers to be able to iterate on the sign-up process i.e. sign-up, delete account - rinse and repeat.

I did find a custom policy sample here https://github.com/azure-ad-b2c/samples/tree/master/policies/delete-my-account, but that solution brings far too many unnecessary dependencies along with it - which I have no interest in reviewing and maintaining. Only local accounts and phone sign-up/sign-in need to be considered - and merely extend that with some possibility to delete an account without having direct access to the Azure portal. No existing flows/policies are in need of modification.

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
3,147 questions
0 comments No comments
{count} votes

Accepted answer
  1. Alfredo Revilla - Upwork Top Talent | IAM SWE SWA 27,511 Reputation points
    2023-10-03T23:48:17.73+00:00

    Hello @Veli-Jussi Raitila , in order to delete an Azure AD B2C local consumer account, you can leverage the Microsoft Graph API and/or one of its SDK. Take a look to the Delete a user operation. Ensure the sign-up user journey outputs the User's Object ID claim so that you can pass it to the MS Graph call. Also, you will need to Register a Microsoft Graph application, expose the required permissions and, optionally and as replacement for tenant-wide consent, provide fine-grained consent.

    For more information about what can be done trough Microsoft Graph, take a look to Manage Azure AD B2C with Microsoft Graph.

    Let us know if you need additional assistance. If the answer was helpful, please accept it and rate it so that others facing a similar issue can easily find a solution.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.