Display the name of user in AD B2C instead of unknown

Admin 1 Reputation point
2022-01-27T21:24:08.913+00:00

I am using custom policy to register the user and after successful registration, under the "All Users" tab I am not able to see the full name(firstName+lastName) of the user. Instead it keeps me showing "unknown". I tried Claim Transformations as per the documentation of the Microsoft Azure. Then also it shows me unknown. I am not sure in which policy I need to write ClaimTransformation code. Can anyone properly guide me with my issue?

Azure Active Directory External Identities
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. AmanpreetSingh-MSFT 55,431 Reputation points
    2022-01-28T13:46:56.257+00:00

    Hi @Admin • Thank you for reaching out.

    The reason for the displayName being set as Unknown, even after adding the Claims Transformation, is because Validation Technical Profile runs before OutputClaimTransformation. When signing up via email for the Local User account, LocalAccountSignUpWithLogonEmail technical profile is used. This technical profile includes AAD-UserWriteUsingLogonEmail technical profile as the validation technical profile. If you check AAD-UserWriteUsingLogonEmail technical profile, you can see <PersistedClaim ClaimTypeReferenceId="displayName" DefaultValue="unknown"/> . Since the validation technical profile runs before OutputClaimTransformation, you are getting the DefaultVaue of unknown.

    Please follow the below steps to get displayName by joining givenName + surname of the user.

    • Create below Claims Transformation:
       <ClaimsTransformation Id="CreateDisplayNameFromFirstNameAndLastName" TransformationMethod="FormatStringMultipleClaims">  
         <InputClaims>  
           <InputClaim ClaimTypeReferenceId="givenName" TransformationClaimType="inputClaim1" />  
           <InputClaim ClaimTypeReferenceId="surName" TransformationClaimType="inputClaim2" />  
         </InputClaims>  
         <InputParameters>  
           <InputParameter Id="stringFormat" DataType="string" Value="{0} {1}" />  
         </InputParameters>  
         <OutputClaims>  
           <OutputClaim ClaimTypeReferenceId="displayName" TransformationClaimType="outputClaim" />  
         </OutputClaims>  
       </ClaimsTransformation>  
      
    • Add below Technical Profile:
        <TechnicalProfile Id="Validate-DisplayName">  
             <DisplayName>Validate displayName</DisplayName>  
             <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.ClaimsTransformationProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />  
             <InputClaims>  
               <InputClaim ClaimTypeReferenceId="displayName" />  
             </InputClaims>  
             <OutputClaims>  
               <OutputClaim ClaimTypeReferenceId="displayName" />  
             </OutputClaims>  
             <OutputClaimsTransformations>  
               <OutputClaimsTransformation ReferenceId="CreateDisplayNameFromFirstNameAndLastName" />  
             </OutputClaimsTransformations>  
             <UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />  
           </TechnicalProfile>  
      
    • Add Validate-DisplayName technical profile as validation technical profile under LocalAccountSignUpWithLogonEmail technical profile as mentioned below (in same order):
       <ValidationTechnicalProfiles>  
          <ValidationTechnicalProfile ReferenceId="Validate-DisplayName" />  
          <ValidationTechnicalProfile ReferenceId="AAD-UserWriteUsingLogonEmail" />  
       </ValidationTechnicalProfiles>  
      

    -----------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.