Azure AAD B2C: reading ForceChangePasswordNextLogin with AzureActiveDirectoryProvider

Stefano Sapienti 85 Reputation points
2024-01-05T18:20:33.4966667+00:00

Hi,

I have a signup-signin policy that first ask the username, it checks if the user exists using a technical profile that reads the user as explained in https://learn.microsoft.com/en-us/azure/active-directory-b2c/active-directory-technical-profile

I would like, in that step, to check if the user password is expired/must be changed but it seems not possible using AzureActiveDirectoryProvider. Can you help on reaching my goal?

What I've done so far:

Reading this article https://learn.microsoft.com/en-us/azure/active-directory-b2c/force-password-reset I managed to set the flag in the password profile and I can read it with OpenIdConnect protocol like in the sample policy https://github.com/azure-ad-b2c/samples/tree/master/policies/force-password-reset

What I'm not able to do is read this flag BEFORE entering the password. If I try to read it inside AAD-UserReadUsingEmailAddress I receive the error "Output Claim 'passwordProfile.forceChangePasswordNextSignIn' is not supported in Azure Active Directory Provider technical profile 'AAD-UserReadUsingEmailAddress'"
I tried with passwordProfile.forceChangePasswordNextSignIn, forceChangePasswordNextSignIn, passwordProfile.forceChangePasswordNextLogin, forceChangePasswordNextLogin and also passwordExpired as returned by OpenIdConnect, but without success.

The documentation https://learn.microsoft.com/en-us/azure/active-directory-b2c/user-profile-attributes#password-profile-property is not clear if the attribute is only fro writing and not for reading.

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. Alfredo Revilla - Upwork Top Talent | IAM SWE SWA 27,526 Reputation points Moderator
    2024-01-08T06:16:58.8433333+00:00

    Hello @Stefano Sapienti , as you’ve already discovered, Azure AD B2C does not support the user passwordProfile attribute. To read it, you could create a custom REST API or function that calls the Microsoft Graph. You can then consume this from your custom policies using a REST Technical Profile.

    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.