Customising the message/error text in Azure AD B2C custom policies

You can customise the message/error text in built-in policies by downloading the JSON file, changing the text and then uploading the file as described .

Localising the text into another language is described .

The default text descriptions and associated id’s are documented .

But then it occurred to me that you could actually “localise” English into English but with different text.

The message I wanted to change was:

“ver_fail_no_retry You’ve made too many incorrect attempts. Please try again later.”

This message is displayed when the user is trying to signup and is trying to enter the email verification code and types the incorrect code three times.

The id documentation page shows:

“ The following are the IDs for a content definition with an ID of api.localaccountsignup or any content definition that starts with api.selfasserted, such as api.selfasserted.profileupdate and api.localaccountpasswordreset.”

So you need to make the change in the appropriate “api.xxx” action. In this case, it’s “api.localaccountsignup”

The XML changes to the TrustFrameworkExtensions.xml file are:

Notice we’ve extended “api.localaccountsignup” to “api.localaccountsignup.en”.

The text is changed here:

<LocalizedString ElementType=”UxElement” StringId=”ver_fail_no_retry”>Attempt limit exceeded — please check your email for the correct code</LocalizedString>

The tricky part is figuring out the “ElementType” construct as this is not documented in the id documentation. The easiest way is to download the JSON defaults for built-in policies as described in the first link above.

Then search for the string in the JSON download.

{ “ElementType”: “UxElement”, “ElementId”: null, “StringId”: “ver_fail_no_retry”, “Override”: false, “Value”: “You’ve made too many incorrect attempts. Please try again later.” },

Then upload the TrustFrameworkExtensions.xml file.

When we run the policy and type an invalid code three times:

All good!

The new control plane

“Identity is the new control plane”. Articles around Microsoft Identity, Auth0 and identityserver. Click the “Archive” link at the bottom for more posts.

Rory Braybrook

Written by

NZ Microsoft Identity dude. Azure AD/ADFS. Plus Auth0. North Shore .NET User Group Admin. Ignite - http://bit.ly/2D05Uh7 YouTube - http://bit.ly/2lzBqXQ

The new control plane

“Identity is the new control plane”. Articles around Microsoft Identity, Auth0 and identityserver. Click the “Archive” link at the bottom for more posts.