This design manages Customer Identity (CIAM). Instead of storing passwords in your SQL database (dangerous), you offload login to Azure AD B2C.
Topology: The B2C Tenant is a separate directory. Your Application (in the Spoke VNet) trusts B2C via OIDC.
+--------------+ +--------------------------+ +--------------+
| Customer | | Azure AD B2C | | SPOKE VNet |
| (Browser) | | (Identity) | | (Web App) |
| | | | | |
+------+-------+ +------------+-------------+ +------+-------+
| ^ ^
| (1) Login Request | |
+--------------------------------+ |
| |
| (2) Token Issued (JWT) |
v |
+-----------------------------------------------------------------+
| (3) Access App with Token
v
PRIMARY REGION (East US)
+-----------------------------------------------------------------------+
| SPOKE VNet: vnet-app-spoke |
| +-----------------------+ |
| | Web App (PaaS/VM) | |
| | Config: | |
| | - ClientID: xyz | |
| | - Authority: b2c.com | |
| +-----------------------+ |
+---------------|-------------------------------------------------------+
|
| (Geo-Redundant App)
v
+-----------------------------------------------------------------------+
| SECONDARY REGION (West US) - DR Site |
| |
| +-----------------------+ |
| | Web App (Standby) | |
| | Config: | |
| | - Same B2C Settings | |
| +-----------------------+ |
+-----------------------------------------------------------------------+
*Note: B2C Service itself is Global and Highly Available by Microsoft.
1. User: Clicks "Login" on myapp.com.
2. Redirect: App redirects browser to contoso.b2clogin.com.
3. Auth: User enters email/password (or Google login).
4. Token: B2C validates creds, issues ID Token. Redirects back to myapp.com/callback.
5. Session: App validates token, creates a session cookie.
1. Search: "Azure AD B2C" -> + Create.
2. Create a new Azure AD B2C Tenant.
3. Organization name: ContosoCustomer[UniqueId].
4. Initial domain name: contosocust[uniqueid].onmicrosoft.com.
5. Location: United States.
6. Subscription: Select yours.
7. Resource Group: Create rg-b2c.
8. Create.
* *Note: This creates a completely separate Directory/Tenant.*
1. Wait for deployment to finish.
2. Click the Open new B2C Tenant link (or go to Portal Settings -> Directories).
3. Switch to the ContosoCustomer[UniqueId] directory.
* *You will see the portal reload. You are now "inside" the B2C tenant.*
1. Search: "App registrations" (Inside B2C Tenant).
2. + New registration.
3. Name: WebApp1.
4. Supported account types: Accounts in any identity provider or organizational directory (for authenticating users with user flows).
5. Redirect URI: Web -> https://jwt.ms (Great tool for debugging tokens).
6. Register.
7. Copy the Application (client) ID. Save it.
1. Search: "User flows".
2. + New user flow.
3. Select: Sign up and sign in. -> Create.
4. Name: B2C_1_susi (Prefix B2C_1_ is auto-added usually, or you add it).
5. Identity providers: Email signup.
6. User attributes and token claims:
* Click Show more.
* Select City, Display Name, Given Name, Surname.
* Click OK.
7. Create.
1. Click B2C_1_susi.
2. Click Run user flow.
3. A popup opens. Sign up as a fake user.
4. After signup, it redirects to jwt.ms and shows your Token. Success!