Azure AD b2c Custom policy: Change User Profile picture

Viewed 519

I am trying to change or upload a user profile while signup or profile update in azure active directory b2c using custom policy. I found a "thumbnailPhoto" property having datatype Edm.Stream by using this I am trying to create a custom ClaimType like this. but it's not working please help in changing user profile through custom policy

 <ClaimType Id="thumbnailPhoto">
        <DisplayName>ProfilePicture</DisplayName>
        <DataType>stream</DataType>
        <UserHelpText>Upload profile picture</UserHelpText>
      </ClaimType>

enter image description here

enter image description here

1 Answers

Thanks and Azure B2C support below predefined data types.

Reference:- https://docs.microsoft.com/en-us/azure/active-directory-b2c/claimsschema#datatype

stream

When you upload policy, you will get error - The 'http://schemas.microsoft.com/online/cpim/schemas/2013/06:DataType' element is invalid - The value 'stream' is invalid according to its datatype 'http://schemas.microsoft.com/online/cpim/schemas/2013/06:DataType' - The Enumeration constraint failed.

Proposed Solution:-

You need to use custom development using HTML or B2C with graph api.You can try to use the profilePhoto resource type which lets you get/update a photo. This may work:

GET https://graph.windows.net/myorganization/users/{user_id}/thumbnailPhoto?api-version

PATCH https://graph.windows.net/myorganization/users/{user_id}?api-version

Related