Skip to content

Commit 5e95b8c

Browse files
committed
Merge branch 'master' of https://github.com/Microsoft/azure-docs-pr into lbmetadataupdate1
2 parents f4c8750 + 0c0fa82 commit 5e95b8c

File tree

140 files changed

+2075
-1480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+2075
-1480
lines changed

.openpublishing.redirection.json

Lines changed: 124 additions & 114 deletions
Large diffs are not rendered by default.

articles/active-directory-b2c/TOC.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
href: active-directory-b2c-tutorials-desktop-app-webapi.md
3535
- name: Single page
3636
href: active-directory-b2c-tutorials-spa-webapi.md
37+
- name: Customize the UI
38+
href: tutorial-customize-ui.md
3739
- name: Samples
3840
href: code-samples.md
3941
- name: Concepts
@@ -62,6 +64,8 @@
6264
href: active-directory-b2c-reference-tokens.md
6365
- name: User accounts
6466
href: user-overview.md
67+
- name: User interface customization
68+
href: customize-ui-overview.md
6569
- name: How-to guides
6670
items:
6771
- name: Access audit logs
@@ -72,11 +76,6 @@
7276
href: active-directory-b2c-reference-language-customization.md
7377
- name: Customize password
7478
href: active-directory-b2c-reference-password-complexity.md
75-
- name: Customize user interface
76-
href: active-directory-b2c-reference-ui-customization.md
77-
items:
78-
- name: Helper tool for customization
79-
href: active-directory-b2c-reference-ui-customization-helper-tool.md
8079
- name: Define custom attributes
8180
href: active-directory-b2c-reference-custom-attr.md
8281
- name: Disable email verification
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
title: About user interface customization in Azure Active Directory B2C | Microsoft Docs
3+
description: Learn about how to customize the user interface for your applications that use Azure Active Directory B2C.
4+
services: active-directory-b2c
5+
author: davidmu1
6+
manager: mtillman
7+
8+
ms.service: active-directory
9+
ms.workload: identity
10+
ms.topic: conceptual
11+
ms.date: 10/30/2018
12+
ms.author: davidmu
13+
ms.component: B2C
14+
---
15+
16+
# About user interface customization in Azure Active Directory B2C
17+
18+
The ability for you to brand and customize the user interface (UI) that Azure Active Directory (Azure AD) B2C serves to your applications is important for providing a seamless experience to your customer. These experiences include sign-up, sign-in, profile editing, and password resetting. This article provides information to help you customize the UI of your applications.
19+
20+
Depending on your needs when it comes to these experiences, you customize the UI of your application in different ways. For example:
21+
22+
- If you're using [built-in policies](active-directory-b2c-reference-policies.md) to provide sign-up or sign-in, password reset, or profile-editing experiences in your application, you use the [Azure portal to customize the UI](tutorial-customize-ui.md).
23+
- If you're providing sign-in only, its accompanying password reset page, and verification emails, you use the same customization steps that are used for an [Azure AD sign-in page](../active-directory/fundamentals/customize-branding.md).
24+
- If customers try to edit their profile before they sign in, they are redirected to a page that you customize using the same steps that are used for customizing the Azure AD sign-in page.
25+
- If you're using [custom policies](active-directory-b2c-overview-custom.md) to provide sign-up or sign-in, password reset, or profile-editing in your application, you use [policy files to customize the UI](active-directory-b2c-ui-customization-custom.md).
26+
- If you need to provide dynamic content based on a customer’s decision, you use [custom policies that can change page content](active-directory-b2c-ui-customization-custom-dynamic.md) depending on a parameter that's sent in a query string. For example, the background image on the Azure AD B2C sign-up or sign-in page changes, based on a parameter that you pass from your web or mobile application.
27+
28+
Azure AD B2C runs code in your customer's browser and uses a modern approach called [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/). At run-time, content is loaded from a URL that you specify in a policy. You specify different URLs for different pages. After content is loaded from your URL, it's merged with an HTML fragment inserted from Azure AD B2C, and then displayed to your customer.
29+
30+
Before you start, review the following guidance:
31+
32+
- Azure AD B2C merges HTML content into your pages. Don't copy and try to change the default content that Azure AD B2C provides. It's best to build your HTML content from scratch and use the default content as reference.
33+
- For security reasons, you aren’t allowed to include JavaScript in your content.
34+
- Supported browser versions are:
35+
- Internet Explorer 11, 10 and Edge
36+
- Limited support for Internet Explorer 9 and 8
37+
- Google Chrome 42.0 and above
38+
- Mozilla Firefox 38.0 and above
39+
- Make sure that you don't include form tags in your HTML because it interferes with the POST operations generated by the injected HTML from Azure AD B2C.
40+
41+
## Where do I store UI content?
42+
43+
You can host your UI content anywhere, such as on [Azure Blob storage](../storage/blobs/storage-blobs-introduction.md), web servers, CDNs, AWS S3, or file sharing systems. The important point is that you host the content on a publicly available HTTPS endpoint with CORS enabled. You must use an absolute URL when you specify it in your content.
44+
45+
## How do I get started?
46+
47+
You do the following to customize the UI:
48+
49+
- Create well-formed HTML content with an empty `<div id="api"></div>` element located somewhere in the `<body>`. This element marks where the Azure AD B2C content is inserted. The following example shows a minimal page:
50+
51+
```html
52+
<!DOCTYPE html>
53+
<html>
54+
<head>
55+
<title>!Add your title here!</title>
56+
<link rel="stylesheet" href="https://mystore1.blob.core.windows.net/b2c/style.css">
57+
</head>
58+
<body>
59+
<h1>My B2C Application</h1>
60+
<div id="api"></div> <!-- Leave this element empty because Azure AD B2C will insert content here. -->
61+
</body>
62+
</html>
63+
```
64+
65+
- Host your content on an HTTPS endpoint (with CORS allowed). Both GET and OPTIONS request methods must be enabled when configuring CORS.
66+
- Use CSS to style the UI elements that Azure AD B2C inserts into your page. The following example shows a simple CSS file that also includes settings for the sign-up injected HTML elements:
67+
68+
```css
69+
h1 {
70+
color: blue;
71+
text-align: center;
72+
}
73+
.intro h2 {
74+
text-align: center;
75+
}
76+
.entry {
77+
width: 400px ;
78+
margin-left: auto ;
79+
margin-right: auto ;
80+
}
81+
.divider h2 {
82+
text-align: center;
83+
}
84+
.create {
85+
width: 400px ;
86+
margin-left: auto ;
87+
margin-right: auto ;
88+
}
89+
```
90+
91+
- Create or edit a policy to use the content that you created.
92+
93+
The following table lists the HTML fragments that Azure AD B2C merges into the `<div id="api"></div>` element located in your content.
94+
95+
| Inserted page | Description of HTML |
96+
| ------------- | ------------------- |
97+
| Identity provider selection | Contains a list of buttons for identity providers that the customer can choose from during sign-up or sign-in. These buttons include social identity providers such as Facebook, Google, or local accounts (based on email address or user name). |
98+
| Local account sign-up | Contains a form for local account sign-up based on an email address or a user name. The form can contain different input controls such as text input box, password entry box, radio button, single-select drop-down boxes, and multi-select check boxes. |
99+
| Social account sign-up | May appear when signing up using an existing account from a social identity provider such as Facebook or Google. It’s used when additional information must be collected from the customer using a sign-up form. |
100+
| Unified sign-up or sign-in | Handles both sign-up and sign-in of customers who can use social identity providers such as Facebook, Google, or local accounts. |
101+
| Multi-factor authentication | Customers can verify their phone numbers (using text or voice) during sign-up or sign-in. |
102+
| Error | Provides error information to the customer. |
103+
104+
105+
## How do I localize content?
106+
107+
You localize your HTML content by enabling [language customization](active-directory-b2c-reference-language-customization.md) in your Azure AD B2C tenant. Enabling this feature allows Azure AD B2C to forward the Open ID Connect parameter `ui-locales` to your endpoint. Your content server can use this parameter to provide language-specific HTML pages.
108+
109+
Content can be pulled from different places based on the locale that's used. In your CORS-enabled endpoint, you set up a folder structure to host content for specific languages. You'll call the right one if you use the wildcard value {Culture:RFC5646}. For example, your custom page URI might look like `https://contoso.blob.core.windows.net/{Culture:RFC5646}/myHTML/unified.html`. You can load the page in French by pulling content from `https://contoso.blob.core.windows.net/fr/myHTML/unified.html`
110+
111+
## Examples
112+
113+
For customization examples, download and review these [sample template files](https://github.com/azureadquickstarts/b2c-azureblobstorage-client/archive/master.zip).
114+
115+
## Next steps
116+
117+
- If you're using built-in policies, you can start customizing your UI with the tutorial: [Customize the user interface of your applications in Azure Active Directory B2C](tutorial-customize-ui.md).
118+
- If you're using custom policies, you can start customizing the UI with the article: [Customize the user interface of your application using a custom policy in Azure Active Directory B2C](active-directory-b2c-ui-customization-custom.md).
119+
58.3 KB
Loading
21.3 KB
Loading
38.3 KB
Loading
76.6 KB
Loading
41.5 KB
Loading
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
---
2+
title: Tutorial - Customize the user interface of your applications in Azure Active Directory B2C | Microsoft Docs
3+
description: Learn how to customize the user interface of your applications in Azure Active Directory B2C using the Azure portal.
4+
services: B2C
5+
author: davidmu1
6+
manager: mtillman
7+
8+
ms.service: active-directory
9+
ms.workload: identity
10+
ms.topic: conceptual
11+
ms.date: 10/30/2018
12+
ms.author: davidmu
13+
ms.component: B2C
14+
---
15+
16+
# Tutorial: Customize the user interface of your applications in Azure Active Directory B2C
17+
18+
For more common user experiences, such as sign-up, sign-in, and profile editing, you can use [built-in policies](active-directory-b2c-reference-policies.md) in Azure Active Directory (Azure AD) B2C. The information in this tutorial helps you to learn how to [customize the user interface (UI)](customize-ui-overview.md) of these experiences using your own HTML and CSS files.
19+
20+
In this article, you learn how to:
21+
22+
> [!div class="checklist"]
23+
> * Create UI customization files
24+
> * Create a sign-up and sign-in policy that uses the files
25+
> * Test the customized UI
26+
27+
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
28+
29+
## Prerequisites
30+
31+
If you haven't already created your own [Azure AD B2C Tenant](tutorial-create-tenant.md), create one now. You can use an existing tenant if you created one in a previous tutorial.
32+
33+
## Create customization files
34+
35+
You create an Azure storage account and container and then place basic HTML and CSS files in the container.
36+
37+
### Create a storage account
38+
39+
Although you can store your files in many ways, for this tutorial, you store them in [Azure Blob storage](../storage/blobs/storage-blobs-introduction.md).
40+
41+
1. Make sure you're using the directory that contains your Azure subscription. Select the **Directory and subscription filter** in the top menu and choose the directory that contains your subscription. This directory is different than the one that contains your Azure B2C tenant.
42+
43+
![Switch to subscription directory](./media/tutorial-customize-ui/switch-directories.png)
44+
45+
2. Choose All services in the top-left corner of the Azure portal, search for and select **Storage accounts**.
46+
3. Select **Add**.
47+
4. Under **Resource group**, select **Create new**, enter a name for the new resource group, and then click **OK**.
48+
5. Enter a name for the storage account. The name you choose must be unique across Azure, must be between 3 and 24 characters in length, and may contain numbers and lowercase letters only.
49+
6. Select the location of the storage account or accept the default location.
50+
7. Accept all other default values, select **Review + create**, and then click **Create**.
51+
8. After the storage account is created, select **Go to resource**.
52+
53+
### Create a container
54+
55+
1. On the overview page of the storage account, select **Blobs**.
56+
2. Select **Container**, enter a name for the container, choose **Blob (anonymous read access for blobs only)**, and then click **OK**.
57+
58+
### Enable CORS
59+
60+
Azure AD B2C code in a browser uses a modern and standard approach to load custom content from a URL that you specify in a policy. Cross-origin resource sharing (CORS) allows restricted resources on a web page to be requested from other domains.
61+
62+
1. In the menu, select **CORS**.
63+
2. For **Allowed origins**, **Allowed headers**, and **Exposed headers**, enter `your-tenant-name.b2clogin.com`. Replace `your-tenant-name` with the name of your Azure AD B2C tenant. For example, `fabrikam.b2clogin.com`.
64+
3. For **Allowed verbs**, select both `GET` and `OPTIONS`.
65+
4. For **Max age**, enter 200.
66+
67+
![Enable CORS](./media/tutorial-customize-ui/enable-cors.png)
68+
69+
5. Click **Save**.
70+
71+
### Create the customization files
72+
73+
To customize the UI of the sign-up experience, you start by creating a simple HTML and CSS file. You can configure your HTML any way you want, but it must have a **div** element with an identifier of `api`. For example, `<div id="api"></div>`. Azure AD B2C injects elements into the `api` container when the page is displayed.
74+
75+
1. In a local folder, create the following file and make sure that you change `your-storage-account` to the name of the storage account and `your-container` to the name of the container that you created. For example, `https://store1.blob.core.windows.net/b2c/style.css`.
76+
77+
```html
78+
<!DOCTYPE html>
79+
<html>
80+
<head>
81+
<title>My B2C Application</title>
82+
<link rel="stylesheet" href="https://your-storage-account.blob.core.windows.net/your-container/style.css">
83+
</head>
84+
<body>
85+
<h1>My B2C Application</h1>
86+
<div id="api"></div>
87+
</body>
88+
</html>
89+
```
90+
91+
The page can be designed any way that you want, but the **api** div element is required for any HTML customization file that you create.
92+
93+
3. Save the file as *custom-ui.html*.
94+
4. Create the following simple CSS that centers all elements on the sign-up or sign-in page including the elements that Azure AD B2C injects.
95+
96+
```css
97+
h1 {
98+
color: blue;
99+
text-align: center;
100+
}
101+
.intro h2 {
102+
text-align: center;
103+
}
104+
.entry {
105+
width: 300px ;
106+
margin-left: auto ;
107+
margin-right: auto ;
108+
}
109+
.divider h2 {
110+
text-align: center;
111+
}
112+
.create {
113+
width: 300px ;
114+
margin-left: auto ;
115+
margin-right: auto ;
116+
}
117+
```
118+
119+
5. Save the file as *style.css*.
120+
121+
### Upload the customization files
122+
123+
In this tutorial, you store the files that you created in the storage account so that Azure AD B2C can access them.
124+
125+
1. Choose **All services** in the top-left corner of the Azure portal, search for and select **Storage accounts**.
126+
2. Select the storage account you created, select **Blobs**, and then select the container that you created.
127+
3. Select **Upload**, navigate to and select the *custom-ui.html* file, and then click **Upload**.
128+
129+
![Upload customization files](./media/tutorial-customize-ui/upload-blob.png)
130+
131+
4. Copy the URL for the file that you uploaded to use later in the tutorial.
132+
5. Repeat step 3 and 4 for the *style.css* file.
133+
134+
## Create a sign-up and sign-in policy
135+
136+
To complete the steps in this tutorial, you need to create a test application and a sign-up or sign-in policy in Azure AD B2C. You can apply the principles described in this tutorial to the other user experiences, such as profile editing.
137+
138+
### Create an Azure AD B2C application
139+
140+
Communication with Azure AD B2C occurs through an application that you create in your tenant. The following steps create an application that redirects the authorization token that is returned to [https://jwt.ms](https://jwt.ms).
141+
142+
1. Sign in to the [Azure portal](https://portal.azure.com).
143+
2. Make sure you're using the directory that contains your Azure AD B2C tenant by clicking the **Directory and subscription filter** in the top menu and choosing the directory that contains your tenant.
144+
3. Choose **All services** in the top-left corner of the Azure portal, and then search for and select **Azure AD B2C**.
145+
4. Select **Applications**, and then select **Add**.
146+
5. Enter a name for the application, for example *testapp1*.
147+
6. For **Web App / Web API**, select `Yes`, and then enter `https://jwt.ms` for the **Reply URL**.
148+
7. Click **Create**.
149+
150+
### Create the policy
151+
152+
To test your customization files, you create a built-in sign-up or sign-in policy that uses the application that you previously created.
153+
154+
1. In your Azure AD B2C tenant, select **Sign-up or sign-in policies**, and then click **Add**.
155+
2. Enter a name for the policy. For example, *signup_signin*. The prefix *B2C_1* is automatically added to the name when the policy is created.
156+
3. Select **Identity providers**, set **Email sign-up** for a local account, and then click **OK**.
157+
4. Select **Sign-up attributes**, choose the attributes that you want to collect from the customer during sign-up. For example, set **Country/Region**, **Display Name**, and **Postal Code**, and then click **OK**.
158+
5. Select **Application claims**, choose the claims that you want returned in the authorization tokens sent back to your application after a successful sign-up or sign-in experience. For example, select **Display Name**, **Identity Provider**, **Postal Code**, **User is new** and **User's Object ID**, and then click **OK**.
159+
6. Select **Page UI customization**, select **Unified sign-up or sign-in page**, and the click **Yes** for **Use custom page**.
160+
7. In **Custom page URI**, enter the URL for the *custom-ui.html* file that you recorded earlier, and then click **OK**.
161+
8. Click **Create**.
162+
163+
## Test the policy
164+
165+
1. In your Azure AD B2C tenant, select **Sign-up or sign-in policies**, and then select the policy that you created. For example, *B2C_1_signup_signin*.
166+
2. Make sure that the application that you created is selected in **Select application**, and then click **Run Now**.
167+
168+
![Run the sign-up or sign-in policy](./media/tutorial-customize-ui/signup-signin.png)
169+
170+
You should see a page similar to the following example with the elements centered based on the CSS file that you created:
171+
172+
![Policy results](./media/tutorial-customize-ui/run-now.png)
173+
174+
## Next steps
175+
176+
In this article, you learned how to:
177+
178+
> [!div class="checklist"]
179+
> * Create UI customization files
180+
> * Create a sign-up and sign-in policy that uses the files
181+
> * Test the customized UI
182+
183+
> [!div class="nextstepaction"]
184+
> [Language customization in Azure Active Directory B2C](active-directory-b2c-reference-language-customization.md)

0 commit comments

Comments
 (0)