Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting empty value for Custom Attribute with Azure AD B2C

Tags:

azure-ad-b2c

I've set up a custom sign up and a profile edit policy with Azure AD B2C. I created a custom attribute that a user can fill out. It's optional. However, I ran into a problem that if a user sets a value for this attribute during sign up they cannot remove that value and replace it with an empty string. B2C will dismiss this empty value and leave the original value untouched. Only if a user sets a different non-empty value that value gets persisted.

like image 361
Matt Wise Avatar asked Mar 04 '19 19:03

Matt Wise


People also ask

Is Azure AD B2C deprecated?

Yes. Azure Active Directory (AD) Connect and components of V1. 0 are to be deprecated and retired on and prior to August 30, 2022.

How do I create a custom policy in Azure B2C?

On the Portal settings | Directories + subscriptions page, find your Azure AD B2C directory in the Directory name list, and then select Switch. In the Azure portal, search for and select Azure AD B2C. On the overview page, under Policies, select Identity Experience Framework. Select Policy Keys and then select Add.


1 Answers

For your custom policies, you need to add a metadata item in to the technical profiles you want to receive null values from claims. In the scenario you outline, if you update the SelfAsserted-ProfileUpdate technical profile (assuming this is the technical profile your EditProfile user flow references) with this metadata item, you should be able to update an attribute and receive a null claim back, meaning the attribute gets cleared in AAD. Here is the metadata item to add:

<Item Key="AllowGenerationOfClaimsWithNullValues">true</Item>

Give this a shot and let me know if it resolves your issue.

like image 99
Josh Douglas Avatar answered Sep 20 '22 18:09

Josh Douglas