Azure AD B2C - Notes
In Azure AD B2C you’ve two ways to provide identity UX:
- user flows - predefined, built-in, configurable policies so you can create sign-up/in and policy editing UX in minutes.
- custom policies - enable you to create your own user journeys for complex identity experience scenarios.
User Flows
For the most common identity tasks. Things like:
- Account types used for sign-in, such as social accounts or local accounts.
- Attributes to be collected from the consumer.
- MFA
- User interface customization
- Set of claims in a token your app receives
Custom Policies
They’re config files that define the behaviour of your Azure AD B2C tenant UX. They can be fully edited by an identity developer to complete many different tasks.
It’s fully configurable and policy-driven.
- Federate with other identity providers
- Third party MFA
- Collect any user input
- Integrate with external systems using REST API communication
Each user journey is defined by a policy. You can build as many or as few policies as you need.
Defined by several XML files that refer to each other in a hierarchical chain.
Starter Pack
The starter pack comes with pre-built policies.
- LocalAccounts - Enables the use of local accounts only.
- SocialAccounts - Enables the use of social (or federated) accounts only.
- SocialAndLocalAccounts - Enables the use of both local and social accounts. Most of our samples refer to this policy.
- SocialAndLocalAccountsWithMFA - Enables social, local, and multi-factor authentication options.
Each starter pack includes:
- a base file that contains most definitions. To help with troubleshooting and long-term maintenance of your policies, try to minimize the number of changes you make to this file.
- an extension file holds the unique config changes for your tenant. This file is derived from the base file. Use this to add new functionality or override existing functionality. e.g. to federate with new identity providers.
- a relying party (RP) file is the single task-focused file that’s invoked directly by the relying party application, such as web, mobile or desktop app. Each unique task such as sign-up/in, password reset etc requires its own relying party policy file. This file is derived from the extensions file. You can add more relying party policies. (e.g. delete my account, change a phone number…)
The basics
Claim
A claim provides temporary storage of data during an Azure AD B2C policy execution. It can store info about the user, such as first name, last name… or any other claim obtainer from the user or other systems. The claim schema is the place where you declare your claims.
When a policy runs, B2C sends and receives claims to and from internal and external parties, then sends a subset of these claims to your relying party app as part of the token.
- Claims are saved, read, or updated against the directory user object.
- Claims are received from an external identity provder.
- Claims are sent or received using a custom REST API service.
- Data is collected as claims from the user during sign-up or edit profile flows.
Claims transformation are predefined functions to convert a given claim into another one, evaluate a claim or set a claim value.
User Journey
They allow you to define business logic with path through which users will follow to gain access to your application. The user is taken through this journey to retrieve the claims that are to be presented to your app.
A user journey is built from a sequence of orchestration steps.
How you can add orchestration steps to social and local account starter pack.
Orchestration Steps
A user must reach the last step to acquire a token. Orchestration steps can be conditionally executed based on preconditions. After an step completes, B2C stores the outputted claims in the claims bag. This bag can be used by any further orchestration steps in the user’s journey.
Reference(s)
https://docs.microsoft.com/en-us/azure/active-directory-b2c/user-flow-overview
https://docs.microsoft.com/en-us/azure/active-directory-b2c/custom-policy-overview