“A required Metadata item with key \””ClientId\”” was not found in the TechnicalProfile with id …” error in Azure AD B2C

Rory Braybrook
The new control plane
2 min readNov 23, 2023

I was creating a custom policy when I got this error:

Image of AADB2C90037 error

A quick look at AppInsights and I see:

""Exception"": {
""Kind"": ""Handled"",
""HResult"": ""80131500"",
""Message"": ""A required Metadata item with key \""ClientId\"" was not
found in the TechnicalProfile with id \""AAD-UserReadUsingEmailAddress\""
in policy \""..."" of tenant \""tenant.onmicrosoft.com\""."",
""Data"": {
""IsPolicySpecificError"": true,
...

WTF! There is no clientID in UserRead? And Mr. Google had nothing to offer 😢

So I did a bit of poking around and realised that one of the attributes that I was reading was an extension attribute. Which rang a bell …

As per the docs, you need to configure this:

<TechnicalProfile Id="AAD-Common">
<Metadata>
<!--Insert b2c-extensions-app application ID here, for example: 11111111-1111-1111-1111-111111111111-->
<Item Key="ClientId"></Item>
<!--Insert b2c-extensions-app application ObjectId here, for example: 22222222-2222-2222-2222-222222222222-->
<Item Key="ApplicationObjectId"></Item>
</Metadata>
</TechnicalProfile>

So when I tried to read the extension attribute, the clientID it referred to was the one in the AAD-Common technical profile. A somewhat misleading error message!

All good!

--

--

The new control plane
The new control plane

Published in 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
Rory Braybrook

Written by Rory Braybrook

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