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

Rory Braybrook
The new control plane
2 min readJan 17, 2019

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 here.

Localising the text into another language is described here.

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

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!

--

--

Rory Braybrook
The new control plane

NZ Microsoft Identity dude and MVP. Azure AD/B2C/ADFS/Auth0/identityserver. StackOverflow: https://bit.ly/2XU4yvJ Presentations: http://bit.ly/334ZPt5