In my user subscription journey, I have a step that calls a REST service. It's an Azure function that calls Graph to add the user to a Group. Yesterday this function threw an Exception that returned a 500 to the calling policy. Is there any way to "catch" this kind of error and prevent it from crashing the policy execution? Since it's a subscription policy, I'd like to delete the user in a subsequent (conditional with PreCondition) step if an error append in the membership assignment step.
Here's the TP that calls the API :
<TechnicalProfile Id="SetUserAppRoleAssignment">
<DisplayName>Set groups assigned to the user from caller</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="ServiceUrl">{Settings:SetGroupRoleServiceUrl}</Item>
<Item Key="AuthenticationType">None</Item>
<Item Key="SendClaimsIn">Body</Item>
<Item Key="AllowInsecureAuthInProduction">false</Item>
<Item Key="IncludeClaimResolvingInClaimsHandling">true</Item>
<Item Key="AlwaysUseDefaultValue">true</Item>
</Metadata>
<InputClaims>
<InputClaim ClaimTypeReferenceId="objectId" PartnerClaimType="userId" Required="true" />
<InputClaim ClaimTypeReferenceId="tenantId" DefaultValue="{Settings:TenantObjectId}" />
<InputClaim ClaimTypeReferenceId="group_name" DefaultValue="{OAUTH-KV:memberOf}" />
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="groups" />
</OutputClaims>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
</TechnicalProfile>
NOTE : this is used in a claims exchange step, not as a ValidationTechnicalProfile, so the "ContinueOnError" property doesn't seem to be an option.
<!-- Set group assignment -->
<OrchestrationStep Order="4" Type="ClaimsExchange">
<ClaimsExchanges>
<ClaimsExchange Id="SetUserAppRoleAssignment" TechnicalProfileReferenceId="SetUserAppRoleAssignment" />
</ClaimsExchanges>
</OrchestrationStep>
Done! Thanks for the answer!