Skip to content

Commit 7b1a1c4

Browse files
authored
Merge pull request #201910 from dlepow/msalv2
[APIM] MSALv2 in dev portal
2 parents 099b4f6 + d6221bd commit 7b1a1c4

File tree

2 files changed

+60
-17
lines changed

2 files changed

+60
-17
lines changed

articles/api-management/api-management-howto-aad-b2c.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: dlepow
77

88
ms.service: api-management
99
ms.topic: how-to
10-
ms.date: 09/28/2021
10+
ms.date: 07/12/2022
1111
ms.author: danlep
1212
---
1313

@@ -18,6 +18,10 @@ Azure Active Directory B2C is a cloud identity management solution for consumer-
1818

1919
In this tutorial, you'll learn the configuration required in your API Management service to integrate with Azure Active Directory B2C. As noted later in this article, if you are using the deprecated legacy developer portal, some steps will differ.
2020

21+
> [!IMPORTANT]
22+
> * This article has been updated with steps to configure an Azure AD B2C app using the Microsoft Authentication Library ([MSAL](../active-directory/develop/msal-overview.md)) v2.0.
23+
> * If you previously configured an Azure AD B2C app for user sign-in using the Azure AD Authentication Library (ADAL), we recommend that you [migrate to MSAL](#migrate-to-msal).
24+
2125
For information about enabling access to the developer portal by using classic Azure Active Directory, see [How to authorize developer accounts using Azure Active Directory](api-management-howto-aad.md).
2226

2327
## Prerequisites
@@ -47,7 +51,9 @@ In this section, you'll create a user flow in your Azure Active Directory B2C te
4751

4852
1. In a separate [Azure portal](https://portal.azure.com) tab, navigate to your API Management instance.
4953
1. Under **Developer portal**, select **Identities** > **+ Add**.
50-
1. In the **Add identity provider** page, select **Azure Active Directory B2C**.
54+
1. In the **Add identity provider** page, select **Azure Active Directory B2C**. Once selected, you'll be able to enter other necessary information.
55+
* In the **Client library** dropdown, select **MSAL**.
56+
* To add other settings, see steps later in the article.
5157
1. In the **Add identity provider** window, copy the **Redirect URL**.
5258

5359
:::image type="content" source="media/api-management-howto-aad-b2c/b2c-identity-provider-redirect-url.png" alt-text="Copy redirect URL":::
@@ -56,7 +62,7 @@ In this section, you'll create a user flow in your Azure Active Directory B2C te
5662
1. In the **Register an application** page, enter your application's registration information.
5763
* In the **Name** section, enter an application name of your choosing.
5864
* In the **Supported account types** section, select **Accounts in any identity provider or organizational directory (for authenticating users with user flows)**. For more information, see [Register an application](../active-directory/develop/quickstart-register-app.md#register-an-application).
59-
* In **Redirect URI**, enter the Redirect URL your copied from your API Management instance.
65+
* In **Redirect URI**, select **Single-page application (SPA)** and paste the redirect URL you saved from a previous step.
6066
* In **Permissions**, select **Grant admin consent to openid and offline_access permissions.**
6167
* Select **Register** to create the application.
6268

@@ -82,9 +88,27 @@ In this section, you'll create a user flow in your Azure Active Directory B2C te
8288

8389
:::image type="content" source="media/api-management-howto-aad-b2c/add-identity-provider.png" alt-text="Active Directory B2c identity provider configuration":::
8490
1. After you've specified the desired configuration, select **Add**.
91+
1. Republish the developer portal for the Azure AD B2C configuration to take effect. In the left menu, under **Developer portal**, select **Portal overview** > **Publish**.
8592

8693
After the changes are saved, developers will be able to create new accounts and sign in to the developer portal by using Azure Active Directory B2C.
8794

95+
## Migrate to MSAL
96+
97+
If you previously configured an Azure AD B2C app for user sign-in using the ADAL, you can use the portal to migrate the app to MSAL and update the identity provider in API Management.
98+
99+
### Update Azure AD B2C app for MSAL compatibility
100+
101+
For steps, see [Switch redirect URIs to the single-page application type](../active-directory/develop/migrate-spa-implicit-to-auth-code.md#switch-redirect-uris-to-spa-platform).
102+
103+
### Update identity provider configuration
104+
105+
1. In the left menu of your API Management instance, under **Developer portal**, select **Identities**.
106+
1. Select **Azure Active Directory B2C** from the list.
107+
1. In the **Client library** dropdown, select **MSAL**.
108+
1. Select **Update**.
109+
1. [Republish your developer portal](api-management-howto-developer-portal-customize.md#publish-from-the-azure-portal).
110+
111+
88112
## Developer portal - add Azure Active Directory B2C account authentication
89113

90114
> [!IMPORTANT]
@@ -137,6 +161,7 @@ The **Sign-up form: OAuth** widget represents a form used for signing up with OA
137161

138162
* [Azure Active Directory B2C overview]
139163
* [Azure Active Directory B2C: Extensible policy framework]
164+
* Learn more about [MSAL](../active-directory/develop/msal-overview.md) and [migrating to MSAL v2](../active-directory/develop/msal-migration.md)
140165
* [Use a Microsoft account as an identity provider in Azure Active Directory B2C]
141166
* [Use a Google account as an identity provider in Azure Active Directory B2C]
142167
* [Use a LinkedIn account as an identity provider in Azure Active Directory B2C]

articles/api-management/api-management-howto-aad.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Learn how to enable user sign-in to the API Management developer po
66
author: dlepow
77
ms.service: api-management
88
ms.topic: article
9-
ms.date: 05/20/2022
9+
ms.date: 07/12/2022
1010
ms.author: danlep
1111
---
1212

@@ -17,6 +17,10 @@ In this article, you'll learn how to:
1717
> * Enable access to the developer portal for users from Azure Active Directory (Azure AD).
1818
> * Manage groups of Azure AD users by adding external groups that contain the users.
1919
20+
> [!IMPORTANT]
21+
> * This article has been updated with steps to configure an Azure AD app using the Microsoft Authentication Library ([MSAL](../active-directory/develop/msal-overview.md)).
22+
> * If you previously configured an Azure AD app for user sign-in using the Azure AD Authentication Library (ADAL), we recommend that you [migrate to MSAL](#migrate-to-msal).
23+
2024
## Prerequisites
2125

2226
- Complete the [Create an Azure API Management instance](get-started-create-service-instance.md) quickstart.
@@ -55,10 +59,9 @@ After the Azure AD provider is enabled:
5559

5660
1. In the left menu of your API Management instance, under **Developer portal**, select **Identities**.
5761
1. Select **+Add** from the top to open the **Add identity provider** pane to the right.
58-
1. Under **Type**, select **Azure Active Directory** from the drop-down menu.
59-
* Once selected, you'll be able to enter other necessary information.
60-
* Information includes **Client ID** and **Client secret**.
61-
* See more information about these controls later in the article.
62+
1. Under **Type**, select **Azure Active Directory** from the drop-down menu. Once selected, you'll be able to enter other necessary information.
63+
* In the **Client library** dropdown, select **MSAL**.
64+
* To add **Client ID** and **Client secret**, see steps later in the article.
6265
1. Save the **Redirect URL** for later.
6366

6467
:::image type="content" source="media/api-management-howto-aad/api-management-with-aad001.png" alt-text="Screenshot of adding identity provider in Azure portal.":::
@@ -75,14 +78,14 @@ After the Azure AD provider is enabled:
7578
1. Select **New registration**. On the **Register an application** page, set the values as follows:
7679

7780
* Set **Name** to a meaningful name such as *developer-portal*
78-
* Set **Supported account types** to **Accounts in this organizational directory only**.
79-
* In **Redirect URI**, select **Web** and paste the redirect URL you saved from a previous step.
81+
* Set **Supported account types** to **Accounts in any organizational directory**.
82+
* In **Redirect URI**, select **Single-page application (SPA)** and paste the redirect URL you saved from a previous step.
8083
* Select **Register**.
8184

8285
1. After you've registered the application, copy the **Application (client) ID** from the **Overview** page.
8386
1. Switch to the browser tab with your API Management instance.
8487
1. In the **Add identity provider** window, paste the **Application (client) ID** value into the **Client ID** box.
85-
1. Switch to the browser tab with the App Registration.
88+
1. Switch to the browser tab with the App registration.
8689
1. Select the appropriate app registration.
8790
1. Under the **Manage** section of the side menu, select **Certificates & secrets**.
8891
1. From the **Certificates & secrets** page, select the **New client secret** button under **Client secrets**.
@@ -122,6 +125,23 @@ After the Azure AD provider is enabled:
122125
* Optionally configure other sign-in settings by selecting **Identities** > **Settings**. For example, you might want to redirect anonymous users to the sign-in page.
123126
* Republish the developer portal after any configuration change.
124127

128+
## Migrate to MSAL
129+
130+
If you previously configured an Azure AD app for user sign-in using the ADAL, you can use the portal to migrate the app to MSAL and update the identity provider in API Management.
131+
132+
### Update Azure AD app for MSAL compatibility
133+
134+
For steps, see [Switch redirect URIs to the single-page application type](../active-directory/develop/migrate-spa-implicit-to-auth-code.md#switch-redirect-uris-to-spa-platform).
135+
136+
### Update identity provider configuration
137+
138+
1. In the left menu of your API Management instance, under **Developer portal**, select **Identities**.
139+
1. Select **Azure Active Directory** from the list.
140+
1. In the **Client library** dropdown, select **MSAL**.
141+
1. Select **Update**.
142+
1. [Republish your developer portal](api-management-howto-developer-portal-customize.md#publish-from-the-azure-portal).
143+
144+
125145
## Add an external Azure AD group
126146

127147
Now that you've enabled access for users in an Azure AD tenant, you can:
@@ -135,9 +155,9 @@ Follow these steps to grant:
135155
1. Update the first 3 lines of the following Azure CLI script to match your environment and run it.
136156

137157
```azurecli
138-
$subId = "Your Azure subscription ID" #e.g. "1fb8fadf-03a3-4253-8993-65391f432d3a"
139-
$tenantId = "Your Azure AD Tenant or Organization ID" #e.g. 0e054eb4-e5d0-43b8-ba1e-d7b5156f6da8"
140-
$appObjectID = "Application Object ID that has been registered in AAD" #e.g. "2215b54a-df84-453f-b4db-ae079c0d2619"
158+
$subId = "Your Azure subscription ID" # Example: "1fb8fadf-03a3-4253-8993-65391f432d3a"
159+
$tenantId = "Your Azure AD Tenant or Organization ID" # Example: 0e054eb4-e5d0-43b8-ba1e-d7b5156f6da8"
160+
$appObjectID = "Application Object ID that has been registered in AAD" # Example: "2215b54a-df84-453f-b4db-ae079c0d2619"
141161
#Login and Set the Subscription
142162
az login
143163
az account set --subscription $subId
@@ -210,10 +230,8 @@ Your user is now signed in to the developer portal for your API Management servi
210230

211231
## Next Steps
212232

213-
- Learn how to [Protect your web API backend in API Management by using OAuth 2.0 authorization with Azure AD](./api-management-howto-protect-backend-with-aad.md)
214233
- Learn more about [Azure Active Directory and OAuth2.0](../active-directory/develop/authentication-vs-authorization.md).
215-
- Check out more [videos](https://azure.microsoft.com/documentation/videos/index/?services=api-management) about API Management.
216-
- For other ways to secure your back-end service, see [Mutual Certificate authentication](./api-management-howto-mutual-certificates.md).
234+
- Learn more about [MSAL](../active-directory/develop/msal-overview.md) and [migrating to MSAL](../active-directory/develop/msal-migration.md).
217235
- [Create an API Management service instance](./get-started-create-service-instance.md).
218236
- [Manage your first API](./import-and-publish.md).
219237

0 commit comments

Comments
 (0)