In a previous article I talked about how to authenticate your function application against Azure Active Directory Business to Consumer (which we’re going to call B2C for the sake of my fingers). Chances are in your function you’re going to want to get some of the information which is available as a claim from the bearer token. Here is how to do it.
I have a durable functions project which orchestrates several thousand function calls the purpose of which is to scrape and load a bunch of data. It is scheduled to run once a day but one of my concerns was that I didn’t want to accidentally run to functions at the same time. They would duplicate a bunch of the data loading and, at least until the function ran again, chaos would reign. I’m not a huge fan of chaos reigning so I set out to find a way around this.
I had a pretty good struggle setting up Azure Functions and Azure B2C to work together. There are a few guides out there but I wanted to put my own together because I had a terrible time finding these posts initially. The scenario here is that we want a single page application written in React to talk to an API hosted entirely in Azure Functions such that the functions are authenticated.