Is there any way to retry a step in case the result is not good? Like a "for loop"?
Our use case is that a user adds an email address in the UI, our backend adds it to our DB and to B2C via Graph API (new identity type emailAddress) and immidiately after, calls a custom policy with MSAL. In that policy, the first step is a Read operation getting the "signInNames.emailAddress" and objectId with the username (6 digit unique identifier added as identity "signInType": "userName"). the problem we have is it doesn't find the new email address already. If we wait a few secondes (like with a Thread.Sleep in backend for exemple) that works fine.
We also tried reading from Graph API in our backend after the email creation to make sure we can read it and it does. Maybe because it's the same connection used to create the new address? And even so, the policy still doesn't see it at first.
For infos, here's a user from Graph :
"identities": [
{
"signInType": "userName",
"issuer": "mytenant.onmicrosoft.com",
"issuerAssignedId": "151840"
},
{
"signInType": "userPrincipalName",
"issuer": "mytenant.onmicrosoft.com",
"issuerAssignedId": "******@mytenant.onmicrosoft.com"
}
]
After we add the email identity :
"identities": [
{
"signInType": "emailAddress",
"issuer": "kmytenant.onmicrosoft.com",
"issuerAssignedId": "blablabla@Karima ben .com"
},
{
"signInType": "userName",
"issuer": "mytenant.onmicrosoft.com",
"issuerAssignedId": "151840"
},
{
"signInType": "userPrincipalName",
"issuer": "mytenant.onmicrosoft.com",
"issuerAssignedId": "******@mytenant.onmicrosoft.com"
}
]
And the AAD-UserReadUsingIdentifier TP :
<TechnicalProfile Id="AAD-UserReadUsingIdentifier">
<Metadata>
<Item Key="Operation">Read</Item>
<Item Key="RaiseErrorIfClaimsPrincipalDoesNotExist">true</Item>
</Metadata>
<IncludeInSso>false</IncludeInSso>
<InputClaims>
<InputClaim ClaimTypeReferenceId="readOnlySignInName" PartnerClaimType="signInNames" Required="true" />
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="objectId" />
<OutputClaim ClaimTypeReferenceId="signInNames.emailAddress" />
<OutputClaim ClaimTypeReferenceId="strongAuthenticationEmailAddress" />
</OutputClaims>
<IncludeTechnicalProfile ReferenceId="AAD-Common" />
</TechnicalProfile>
readOnlySignInName is a claimed populated with the login_hint query param received from the UI that contains the username.
EDIT the problem is more that the AAD-UserReadUsingIdentifier technical profile doesn't retreive the signInNames.emailAddress but finds it a few seconds later. Some latency between the write with the Graph API call and the Read in the policy. What can cause this? Isolation? Load balancing?