loggingazure-ad-b2cazure-ad-b2c-custom-policyx-correlation-id

How to get detailed exception in Azure B2C Custom policy by Correlation ID?


We are using Azure B2C Custom policies. In production, we are getting some exceptions but in Azure App Insights, exceptions are logged with generic message and Correlation ID only. Not sure how to get detailed exception based on Correlation Id for PROD? I know I should not enable development mode but what is the way to get detailed exception? Can it be anything wrong with our end around logging an exception? I think we just need to configure App Insight Instrumention key for logging? Is there any setting which hiding the actual error?

Here is sample exception logged in AI:

System.Exception
Exception Message:An internal error has occurred., CorrelationID:xxxx

Solution

  • You will not be able to get detailed error messages in production without setting the development mode, unfortunately. As you mentioned, there are some drawbacks to enabling development mode in production.

    Alternatively, Microsoft still logs internally, so you could raise a support ticket in your subscription and ask them to dig into this error message from their end.

    As the exception is generated on runtime of policy code, you will be unable to surface the exception via app insights technical profiles. However, you could add app insights technical profiles before and after each step to narrow down where the exception is happening perhaps.