Skip to content

Commit c739b8c

Browse files
authored
Merge pull request #273123 from dlepow/gaport
[APIM][release-ga-api-center] Self-host APIC portal
2 parents 1b88450 + d8f5032 commit c739b8c

File tree

4 files changed

+74
-41
lines changed

4 files changed

+74
-41
lines changed

articles/api-center/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
href: enable-api-analysis-linting.md
4545
- name: API discovery and consumption
4646
items:
47-
- name: Enable Azure API Center portal
47+
- name: Self-host Azure API Center portal
4848
href: enable-api-center-portal.md
4949
- name: Discover APIs with GitHub Copilot Chat
5050
href: use-vscode-extension-copilot.md

articles/api-center/enable-api-center-portal.md

Lines changed: 72 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,45 @@
11
---
2-
title: Enable API Center portal - Azure API Center
3-
description: Enable the API Center portal, an automatically generated website that enables discovery of your API inventory.
2+
title: Self-host the API Center portal
3+
description: How to self-host the API Center portal, a customer-managed website that enables discovery of the API inventory in your Azure API center.
44
author: dlepow
55
ms.service: api-center
66
ms.topic: how-to
7-
ms.date: 03/18/2024
7+
ms.date: 04/29/2024
88
ms.author: danlep
99
ms.custom:
1010
# Customer intent: As an API program manager, I want to enable a portal for developers and other API stakeholders in my organization to discover the APIs in my organization's API center.
1111
---
1212

13-
# Enable your API Center portal
13+
# Self-host your API Center portal
1414

15-
This article shows how to enable your *API Center portal*, an automatically generated website that developers and other stakeholders in your organization can use to discover the APIs in your [API center](overview.md). The portal is hosted by Azure at a unique URL and restricts user access based on Azure role-based access control.
15+
This article introduces the *API Center portal*, a website that developers and other stakeholders in your organization can use to discover the APIs in your [API center](overview.md). Deploy a reference implementation of the portal from the [API Center portal starter](https://github.com/Azure/APICenter-Portal-Starter.git) repository.
1616

17-
> [!IMPORTANT]
18-
> The Azure-hosted API Center portal is experimental and will be removed from API Center in an upcoming release. You will have an option to self-host an API Center portal for API discovery in an upcoming release.
17+
:::image type="content" source="media/enable-api-center-portal/api-center-portal-signed-in.png" alt-text="Screenshot of the API Center portal after user sign-in.":::
18+
19+
20+
## About the API Center portal
1921

22+
The API Center portal is a website that you can build and host to display the API inventory in your API center. The portal enables developers and other stakeholders in your organization to discover APIs and view API details.
2023

24+
You can build and deploy a reference implementation of the portal using code in the [API Center portal starter](https://github.com/Azure/APICenter-Portal-Starter.git) repository. The portal uses the [Azure API Center data plane API](/rest/api/dataplane/apicenter/operation-groups) to retrieve data from your API center. User access to API information is based on Azure role-based access control.
2125

26+
The API Center portal reference implementation provides:
27+
28+
* A framework for publishing and maintaining a customer-managed API portal using GitHub Actions
29+
* A portal platform that customers can modify or extend to meet their needs
30+
* Flexibility to host on different infrastructures, including deployment to services such as Azure Static Web Apps.
2231

2332
## Prerequisites
2433

2534
* An API center in your Azure subscription. If you haven't created one already, see [Quickstart: Create your API center](set-up-api-center.md).
2635

2736
* Permissions to create an app registration in a Microsoft Entra tenant associated with your Azure subscription, and permissions to grant access to data in your API center.
2837

38+
* To build and deploy the portal, you need a GitHub account and the following tools installed on your local machine:
39+
40+
* [Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
41+
* [Vite package](https://www.npmjs.com/package/vite)
42+
2943
## Create Microsoft Entra app registration
3044

3145
First configure an app registration in your Microsoft Entra ID tenant. The app registration enables the API Center portal to access data from your API center on behalf of a signed-in user.
@@ -36,14 +50,12 @@ First configure an app registration in your Microsoft Entra ID tenant. The app r
3650

3751
* Set **Name** to a meaningful name such as *api-center-portal*
3852
* Under **Supported account types**, select **Accounts in this organizational directory (Single tenant)**.
39-
* In **Redirect URI**, select **Single-page application (SPA)** and enter the following URI, substituting your API center name and region where indicated:
40-
41-
`https://<api-center-name>.portal.<region>.azure-apicenter.ms`
42-
43-
Example: `https://contoso.portal.westeurope.azure-apicenter.ms`
53+
* In **Redirect URI**, select **Single-page application (SPA)** and set the URI.
4454

55+
* For local testing, set the URI to `http://localhost:5173`.
56+
* For production, set the URI to the URI of your API Center portal deployment.
4557
* Select **Register**.
46-
1. On the **Overview** page, copy the **Application (client) ID**. You use this value when you configure the identity provider for the portal in your API center.
58+
1. On the **Overview** page, copy the **Application (client) ID** and the **Directory (tenant) ID**. You set these values when you build the portal.
4759

4860
1. On the **API permissions** page, select **+ Add a permission**.
4961
1. On the **Request API permissions** page, select the **APIs my organization uses** tab. Search for and select **Azure API Center**. You can also search for and select application ID `c3ca1a77-7a87-4dba-b8f8-eea115ae4573`.
@@ -54,41 +66,65 @@ First configure an app registration in your Microsoft Entra ID tenant. The app r
5466

5567
:::image type="content" source="media/enable-api-center-portal/configure-app-permissions.png" alt-text="Screenshot of required permissions in Microsoft Entra ID app registration in the portal." lightbox="media/enable-api-center-portal/configure-app-permissions.png":::
5668

69+
## Configure local environment
5770

58-
## Configure Microsoft Entra ID provider for API Center portal
71+
Follow these steps to build and test the API Center portal locally.
5972

60-
In your API center, configure the Microsoft Entra ID identity provider for the API Center portal.
73+
1. Clone the [API Center portal starter](https://github.com/Azure/APICenter-Portal-Starter.git) repository to your local machine.
6174

62-
1. In the [Azure portal](https://portal.azure.com), navigate to your API center.
63-
1. In the left menu, under **API Center portal**, select **Portal settings**.
64-
1. Select **Identity provider** > **Start set up**.
65-
1. On the **Set up user sign-in with Microsoft Entra ID** page, in **Client ID**, enter the **Application (client) ID** of the app registration that you created in the previous section.
75+
```bash
76+
git clone https://github.com/Azure/APICenter-Portal-Starter.git
77+
```
78+
1. Change to the `APICenter-Portal-Starter` directory.
6679

67-
:::image type="content" source="media/enable-api-center-portal/set-up-sign-in-portal.png" alt-text="Screenshot of the Microsoft Entra ID provider settings in the API Center portal." lightbox="media/enable-api-center-portal/set-up-sign-in-portal.png":::
80+
```bash
81+
cd APICenter-Portal-Starter
82+
```
83+
1. Check out the main branch.
6884

69-
1. Select **Save + publish**. The Microsoft Entra ID provider appears on the **Identity provider** page.
85+
```bash
86+
git checkout main
87+
```
88+
1. To configure the service, edit the `public/config.json` file to point to your service. Update the values in the file as follows:
89+
* Replace `<service name>` and `<region>` with the name of your API center and the region where it's deployed
90+
* Replace `<client ID>` and `<tenant ID>` with the **Application (client) ID** and **Directory (tenant) ID** of the app registration you created in the previous section.
91+
* Update the value of `title` to a name that you want to appear on the portal.
7092
71-
1. To view the API Center portal, on the **Portal settings** page, select **View API Center portal**.
93+
```json
94+
{
95+
"dataApiHostName": "<service name>.data.<region>.azure-apicenter.ms",
96+
"title": "API portal",
97+
"authentication": {
98+
"clientId": "<client ID>",
99+
"tenantId": "<tenant ID>",
100+
"scopes": ["https://azure-apicenter.net/user_impersonation"],
101+
"authority": "https://login.microsoftonline.com/"
102+
}
103+
}
104+
```
72105
73-
The portal is published at the following URL that you can share with developers in your organization: `https://<api-center-name>.<region>.azure-apicenter.ms`.
106+
1. Start the development server to test the portal locally.
74107
75-
:::image type="content" source="media/enable-api-center-portal/api-center-portal-home.png" alt-text="Screenshot of the API Center portal home page.":::
108+
```bash
109+
npm start
110+
```
76111
77-
## Customize portal name
112+
Browse to the portal at `https://localhost:5173`.
78113
79-
By default, the name that appears on the upper left of the API Center portal is the name of your API center. You can customize this name.
114+
1. When you're ready to build the portal for production, run the following command.
80115

81-
1. In the Azure portal, go to the **Portal settings** > **Site profile** page.
82-
1. Enter a new name in **Add a website name**.
83-
1. Select **Save + publish**.
116+
```bash
117+
npm run build
118+
```
84119

85-
:::image type="content" source="media/enable-api-center-portal/add-website-name.png" alt-text="Screenshot of adding a custom website name in the Azure portal.":::
120+
## Deploy to Azure
121+
122+
For steps to deploy the portal to Azure Static Web Apps, see the [API Center portal starter](https://github.com/Azure/APICenter-Portal-Starter.git) repository.
86123

87-
The new name appears after you refresh the API Center portal.
88124

89125
## Enable sign-in to portal by Microsoft Entra users and groups
90126

91-
While the portal URL is publicly accessible, users must sign in to see the APIs in your API center. To enable sign-in, assign the **Azure API Center Data Reader** role to users or groups in your organization, scoped to your API center.
127+
Users must sign in to see the APIs in your API center. To enable sign-in, assign the **Azure API Center Data Reader** role to users or groups in your organization, scoped to your API center.
92128

93129
> [!IMPORTANT]
94130
> By default, you and other administrators of the API center don't have access to APIs in the API Center portal. Be sure to assign the **Azure API Center Data Reader** role to yourself and other administrators.
@@ -111,8 +147,6 @@ After you configure access to the portal, configured users can sign in to the po
111147
> [!NOTE]
112148
> The first user to sign in to the portal is prompted to consent to the permissions requested by the API Center portal app registration. Thereafter, other configured users aren't prompted to consent.
113149

114-
:::image type="content" source="media/enable-api-center-portal/api-center-portal-signed-in.png" alt-text="Screenshot of the API Center portal after user sign-in.":::
115-
116150
## Troubleshooting
117151

118152
### Error: "You are not authorized to access this portal"
@@ -134,10 +168,7 @@ az provider register --namespace Microsoft.ApiCenter
134168

135169
If users who have been assigned the **Azure API Center Data Reader** role can't complete the sign-in flow after selecting **Sign in** in the API Center portal, there might be a problem with the configuration of the Microsoft Entra ID identity provider.
136170

137-
In the Microsoft Entra app registration, review and, if needed, update the **Redirect URI** settings:
138-
139-
* Platform: **Single-page application (SPA)**
140-
* URI: `https://<api-center-name>.portal.<region>.azure-apicenter.ms`. This value must be the URI shown for the Microsoft Entra ID provider for your API Center portal.
171+
In the Microsoft Entra app registration, review and, if needed, update the **Redirect URI** settings to ensure that the URI matches the URI of the API Center portal deployment.
141172

142173
### Unable to select Azure API Center permissions in Microsoft Entra app registration
143174

@@ -151,10 +182,12 @@ az provider register --namespace Microsoft.ApiCenter
151182

152183
After re-registering the resource provider, try again to request API permissions.
153184

185+
## Support policy
186+
187+
Provide feedback, request features, and get support for the API Center portal reference implementation in the [API Center portal starter](https://github.com/Azure/APICenter-Portal-Starter.git) repository.
154188

155189
## Related content
156190

157-
* [Azure CLI reference for API Center](/cli/azure/apic)
158191
* [What is Azure role-based access control (RBAC)?](../role-based-access-control/overview.md)
159192
* [Best practices for Azure RBAC](../role-based-access-control/best-practices.md)
160193
* [Register a resource provider](../azure-resource-manager/management/resource-providers-and-types.md#register-resource-provider)

articles/api-center/index.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ landingContent:
6767
linkLists:
6868
- linkListType: how-to-guide
6969
links:
70-
- text: Enable Azure API Center portal
70+
- text: Self-host Azure API Center portal
7171
url: enable-api-center-portal.md
7272
- text: Discover APIs with GitHub Copilot Chat
7373
url: use-vscode-extension-copilot.md
38.5 KB
Loading

0 commit comments

Comments
 (0)