Rory Braybrook
Oct 29, 2018 · 3 min read

The usual way to troubleshoot B2C issues with custom policies is with Application Insights.

There’s a ton of information shown in Insights and it isn’t always easy to get what you want.

Hence the User Journey Recorder.

The GitHub sample is here.

Inside this is a “UserJourneyRecorder” directory.

(Note: There is another version of the recorder inside of the wintipgamesb2c directory. This integrates the recorder with application insights. There is some documentation in the directory called “How to: Integrate a B2C policy with Azure Application Insights”).

Build this in Visual Studio using the project file “UserJourneyRecorder.sln”and then you need to deploy the project to Azure App Services.

You project will have a URL similar to:

https://userjourneyrecorderwebapp20…39.azurewebsites.net

Note it and use it below in place of the above one.

First you need to create a GUID.

Once you got the custom policies sorted and uploaded and assuming you are using the Signup and Signin policy, in SignUpOrSignin.xml, add two lines:

<TrustFrameworkPolicy
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.microsoft.com/online/cpim/schemas/2013/06"
PolicySchemaVersion="0.3.0.0"
TenantId="tenant.onmicrosoft.com"
PolicyId="B2C_1A_signup_signin"
PublicPolicyUri="http://tenant.onmicrosoft.com/B2C_1A_signup_signin"
DeploymentMode="Development"
UserJourneyRecorderEndpoint="
https://userjourneyrecorderwebapp20...739.azurewebsites.net/stream?id=your GIUD created as above">

Upload the updated policy.

Now test using the “Run Now” button.

This should create the user journey data.

To view it use this URL:

https://userjourneyrecorderwebapp20...739.azurewebsites.net/trace_102.html?id=your GIUD created as above"

i.e. add “trace_102.html”.

You should see:

“Change Refresh Mode” will switch to:

“Configure” will show:

You can alter the parameters as required.

“Refresh Now” will show the actual journey e.g.

“Message Detail” expands the message.

or an API example:

The real value of this tool is the error messages. It will show you the details of the error which is invaluable when debugging.

A “simple” error e.g. trying to register an existing user again shows e.g.

or “Invalid password”

“Download Stream” downloads the log in JSON format e.g.

"Exception": {
"Kind": "Handled",
"HResult": "80131500",
"Message": "Invalid username or password.",
"Data": {}
},
"PredicateResult": "False"
}

I’ve found the tool to be super useful and a time-saver!

There is a good reference for the whole flow here.

All good!

The new control plane

“Identity is the new control plane”. Articles around Microsoft Identity, Auth0 and identityserver. Click the “Archive” link at the bottom for more posts.

Rory Braybrook

Written by

NZ Microsoft Identity dude. Microsoft MVP. Azure AD/B2C/ADFS. Plus Auth0/identityserver. N. Shore .NET UG Admin. Presentations: http://bit.ly/334ZPt5

The new control plane

“Identity is the new control plane”. Articles around Microsoft Identity, Auth0 and identityserver. Click the “Archive” link at the bottom for more posts.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade