How to access Azure AD B2C user data through Azure Functions

Bruno Caruso 41 Reputation points
2022-11-08T19:44:05.367+00:00

Hello everyone

I have a SPA Angular app with AD B2C auth, in sign up flow i need to verify if the user to register company already exists on my app.

It occurs to me to do it this way: checking if the requesting user email domain if are on one of the users of my AD B2C registered users.

Example, a new user registers with:

user1@org1.com

The register will continue, and then logon, because org1.com doesn't exists in any user.

But after this, a new user:

user2@org1.com

Tries to register, AD B2C would reject the register and say: "An admin of your company org1.com needs to approve the register or you need to be invited." or something fail text.

To do this, i'm trying to create a custom policy on my AD B2C tenant on signup to connect to my Function App REST API with Azure Functions, but the authentication in my FunctionApp is configured to authenticate with Microsoft, so all the functions need auth, i need to create a new Function App with anonymous access?? i think that's a bad practice.

Any idea? thanks!

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,220 questions
Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,723 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,211 questions
{count} votes