Search code examples
azure-ad-b2cazure-ad-b2c-custom-policy

Azure b2c custom policy: How to check for accountEnabled in user journey


Really sorry for the open question, but I'm new to custom policies and wasn't able to solve this using documentation alone.

I have a custom policy which includes a user journey with a couple of orchestration steps, and would like to add one more orchestration steps which checks for accountEnabled.

How would i go about that?

Thank you


Solution

  • accountEnabled is read e.g. by "AAD-UserReadUsingEmailAddress".

    So once you have read it, there is a ClaimsTransformation in the base you can use:

    "AssertAccountEnabledIsTrue"

    that is also called by the read.

    Or you could do:

    <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
                  <Value>accountEnabled</Value>
                  <Value>True</Value>
         <Action>SkipThisOrchestrationStep</Action>
    </Precondition> 
    

    Update

    So something like:

    <OrchestrationStep Order="2" Type="ClaimsExchange">
        <Preconditions>
            <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
                <Value>accountEnabled</Value>
                <Value>True</Value>
                <Action>SkipThisOrchestrationStep</Action>
            </Precondition>
        </Preconditions>
        <ClaimsExchanges>
            <ClaimsExchange Id="Some exchange" TechnicalProfileReferenceId="Some exchange"/>        
        </ClaimsExchanges>
    </OrchestrationStep>