Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure AD B2C Password Reset

I am trying to understand how Azure AD B2C password reset is meant to be used.

It appears there are a number of ways password reset can be handled. What is the difference between these? Is there is a price difference between these? Are some of these features of Azure AD, whilst some are features of Azure AD B2C? Why does method 3 below not appear to work?

  1. Via an Azure B2C user flows (policies).

    • The policy for Sign in v1 goes to AD password reset below.
    • Whilst all other policies go to B2C password reset, that allows users to reset their password via their primary email address stored in their user profile.
  2. Via Azure Active Directory Self Service Password Reset. Which is accessible via https://passwordreset.microsoftonline.com. This allows the user to reset their password via any email address stored on their profile.

  3. Reset password button on user profile. This provides a temporary password, however the temporary password does not seem to work.

like image 560
James Wood Avatar asked Feb 20 '19 13:02

James Wood


People also ask

How do I change my Azure B2C password?

Select a sign-up or sign-in user flow (of type Recommended) that you want to customize. In the menu under Settings, select Properties. Under Password configuration, select Self-service password reset. Select Save.

How are passwords stored in Azure AD B2C?

Instead of storing your user account password in clear-text, Windows generates and stores user account passwords by using two different password representations, generally known as "hashes." When you set or change the password for a user account to a password that contains fewer than 15 characters, Windows generates ...

Which Azure AD role can reset the password?

In this article Azure Active Directory (Azure AD) self-service password reset (SSPR) gives users the ability to change or reset their password, with no administrator or help desk involvement.

How do I force a password reset in Azure?

In the Azure portal, search for and select Azure AD B2C. Select Users. Search for and select the user you'll use to test the password reset, and then select Reset Password.

How do I reset the password for an azure B2C user?

Via an Azure B2C user flows (policies). The policy for Sign in v1 goes to AD password reset below. Whilst all other policies go to B2C password reset, that allows users to reset their password via their primary email address stored in their user profile.

How do I reset a user's password in Azure AD?

To let your application users reset their passwords, create a password reset user flow: In the Azure portal, go to the Azure AD B2C tenant overview. In the left menu under Policies, select User flows, and then select New user flow. In Create a user flow, select the Password resetuser flow.

How do I change the password complexity in Azure AD B2C?

In the Azure portal, search for and select Azure AD B2C. Select User flows. Select a sign-up or sign-in user flow (of type Recommended) that you want to customize. Under Settings in the left menu, select Properties. Under Password complexity, select Self-service password reset.

How do I set up Azure AD B2C signup signin?

Open B2C_1A_signup_signin, the relying party (RP) custom policy that you uploaded, and then select Run now. Sign-in with the account you created. Make sure Azure AD B2C asks you to reset the password. Type your password and your profile, and click Continue


2 Answers

AAD B2C ≠ AAD ===> AAD B2C users ≠ AAD users

Currently, we only support two ways to reset Azure AD B2C users' password in general scenario:

  1. Self-service reset password(SSPR) with Azure AD B2C Password reset policy/user flow.

  2. Admins help users to reset password with Azure AD Graph API:https://docs.microsoft.com/en-us/previous-versions/azure/ad/graph/api/users-operations#reset-a-users-password--

Answers to your questions:

What is the difference between these? Is there is a price difference between these? Are some of these features of Azure AD, whilst some are features of Azure AD B2C?

  • Password reset policy/user flow is for AAD B2C users. You can use it directly. AAD B2C users can use this to reset their password by themselves. It's also a kind of SSPR.

  • Azure Active Directory Self Service Password Reset. Generally, it's for enterprise users. As this feature is just for V1 Sign in user flow only, I don't recommend you use this way.

  • Reset password button on user profile. It's for AAD (organization/enterprise) users only. Don't use this button for AAD B2C users.

Why does method 3 below not appear to work?

As I mentioned in the above, this feature is just for Azure AD users. NOT AAD B2C users. Therefore, you cannot reset B2C users' password here.

As Alex said, AAD B2C user is not Azure AD user. B2C users is for 2c senario. Normal Azure AD user is for organization/enterprise scenario.

You can also refer to my answers for What's the difference between Azure AD B2C tenant and normal Azure AD tenant?


More about how B2C password reset policy works:

  • After clicked "forget your password" button in Signup/in policy, AAD B2C will send a message with "AADB2C90118" back to Application.

  • For example, in a ASP.NET MVC Web App, then it should challenge

private Task OnAuthenticationFailed(AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
            {
            notification.HandleResponse();
            // Handle the error code that Azure AD B2C throws when trying to reset a password from the login page 
            // because password reset is not supported by a "sign-up or sign-in policy"
            if (notification.ProtocolMessage.ErrorDescription != null && notification.ProtocolMessage.ErrorDescription.Contains("AADB2C90118"))
            {
                // If the user clicked the reset password link, redirect to the reset password route
                notification.Response.Redirect("/Account/ResetPassword");
            }
  • It means that Application will redirect it /Account/ResetPassword to the after received this message.

  • /Account/ResetPassword is defined here from Account Controller. It should be determined by the password reset policy name which defined by you.

    public void ResetPassword()
            {
                // Let the middleware know you are trying to use the reset password policy (see OnRedirectToIdentityProvider in Startup.Auth.cs)
                HttpContext.GetOwinContext().Set("Policy", Startup.ResetPasswordPolicyId);

                // Set the page to redirect to after changing passwords
                var authenticationProperties = new AuthenticationProperties { RedirectUri = "/" };
                HttpContext.GetOwinContext().Authentication.Challenge(authenticationProperties);

                return;
            }
  • Then the user will be redirected to B2C password reset policy to change his password.
like image 161
Wayne Yang Avatar answered Sep 26 '22 01:09

Wayne Yang


My experience, examples assuming that your B2C tenant is named contoso.onmicrosoft.com or just contoso.com:

  • If you register [email protected] or [email protected] through a signin policy, you can only change your password via the password reset policy. You have a password only for this tenant, even if your account belongs to another AAD.
  • If you manually create an account in the B2C tenant, e.g. [email protected], you can only reset the password via classic AAD methods. This would be 2) and possibly 3) in your case. You login to the B2C applications with the same password.

The only real way in my experience is to use the user flows (policies). The other two only work for the accounts that are specific to the B2C directory in question.

You have to consider that in a B2C scenario, the user's email address could also belong to a "normal" AAD user in a completely different directory (classic B2B). The two tenants/directories don't really know about each other. Even if it is not an AAD account, it could belong to users in multiple different B2C tenants. Each have a seperate password.

like image 39
Alex AIT Avatar answered Sep 26 '22 01:09

Alex AIT