This repository shows how to use Microsoft.Identity.Web with Azure Functions to create an Azure AD protected Web API. You can make some very simple changes in Startup.cs to make this work for B2C also.
You can read more about the code in this repo here.