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?
Via an Azure B2C user flows (policies).
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.
Reset password button on user profile. This provides a temporary password, however the temporary password does not seem to work.
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.
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 ...
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.
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.
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.
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.
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.
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
Currently, we only support two ways to reset Azure AD B2C users' password in general scenario:
Self-service reset password(SSPR) with Azure AD B2C Password reset policy/user flow.
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;
}
My experience, examples assuming that your B2C tenant is named contoso.onmicrosoft.com or just contoso.com:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With