You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/api-center/authorize-api-access.md
+37-40Lines changed: 37 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,13 @@ ms.custom:
10
10
# Customer intent: As an API program manager, I want to store API authorization information in my API center and enable authorized users to test APIs in the API Center portal.
11
11
---
12
12
13
-
# Authorize access to APIs in your API Center inventory
13
+
# Authorize access to APIs in your API center
14
14
15
-
<!-- Is this a governance or inventory feature -->
16
-
17
-
You can configure settings to authorize access to APIs in your API center inventory. These settings:
15
+
You can configure settings to authorize access to APIs in your API center. These settings:
18
16
19
17
* Enable API authentication using API keys or OAuth 2.0 authorization
20
18
* Associate specific authentication methods with specific API versions in your inventory
21
-
*Can limit use of API authentication methods to designated users or groups through access policies
19
+
*Manage authentication to API versions by designated users or groups through access policies
22
20
* Enable authorized users to test APIs directly in the API Center portal
23
21
24
22
> [!NOTE]
@@ -37,7 +35,7 @@ You can configure settings to authorize access to APIs in your API center invent
37
35
* (For OAuth 2.0 authorization using Microsoft Entra ID) Permissions to create an app registration in a Microsoft Entra tenant associated with your Azure subscription.
38
36
39
37
40
-
## Configure settings for API key authentication
38
+
## Option 1: Configure settings for API key authentication
41
39
42
40
For an API that supports API key authentication, follow these steps to configure settings in your API center. The API key must be stored in Azure Key Vault, and access to the key vault is through your API center's managed identity.
43
41
@@ -52,9 +50,6 @@ To store the API key securely, use Azure Key Vault. You can create a new key vau
52
50
> [!NOTE]
53
51
> The *secret identifier* of the secret appears on the secret's details page. This is a URI of the form `https://<key-vault-name>.vault.azure.net/secrets/<secret-name>/<version>`. You need this value when you add the API key configuration in your API center.
54
52
55
-
<!-- Should we use the version of the secret in the URI? -->
56
-
57
-
58
53
### 2. Enable a managed identity in your API center
59
54
60
55
For this scenario, your API center uses a [managed identity](/entra/identity/managed-identities-azure-resources/overview) to access the key vault. Depending on your needs, enable either a system-assigned or one or more user-assigned managed identities.
@@ -78,26 +73,23 @@ Assign your API center's managed identity the **Key Vault Secrets User** role in
78
73
1. On the **Role** tab, select **Key Vault Secrets User**.
79
74
1. On the **Members** tab, in **Assign access to**, select **Managed identity** > **+ Select members**.
80
75
1. On the **Select managed identities** page, select the system-assigned managed identity of your API center that you added in the previous section. Click **Select**.
81
-
1. Select **Review + assign**.
76
+
1. Select **Review + assign** twice.
82
77
83
78
84
79
### 4. Add API key configuration in your API center
85
80
86
-
1. In the [portal](https://azure.microsoft.com), navigate to your key API center.
81
+
1. In the [portal](https://azure.microsoft.com), navigate to your API center.
87
82
1. In the left menu, under **Assets**, select **Authorization (preview)** > **+ Add configuration**.
88
83
1. In the **Add authorization** page, set the values as follows:
89
-
1. Enter a **Title** (name) and optional **Description** for the authorization.
84
+
1. Enter a **Title** (name) and optional **Description** for the configuration.
90
85
1. In **Security scheme**, select **API Key**.
91
86
1. In **API key location**, select how the key is presented in API requests. Available values are **Header** (request header) and **Query** (query parameter).
92
87
1. In **API key parameter name**, enter the name of the HTTP header or query parameter that contains the API key. For example, `x-api-key`.
93
88
1. In **API key Key Vault secret reference**, enter the URI of the secret in your key vault that contains the API key. This is a URI of the form `https://<key-vault-name>.vault.azure.net/secrets/<secret-name>/<version>`.
94
89
1. Select **Create**.
95
90
96
91
97
-
## Configure settings for OAuth 2.0 authorization
98
-
99
-
<!-- Which identity providers are supported? Just Entra? -->
100
-
92
+
## Option 2: Configure settings for OAuth 2.0 authorization
101
93
102
94
For an API that supports OAuth 2.0 authorization, follow these steps to configure authentication settings in your API center. You can configure settings for one or both of the following OAuth 2.0 authorization flows:
103
95
@@ -111,71 +103,68 @@ For OAuth 2.0 authorization, create an app registration in an identity provider,
111
103
112
104
The following example shows how to create an app registration in Microsoft Entra ID.
113
105
114
-
<!-- NOT COMPLETE. What about Redirect URI? How to configure scopes? -->
115
-
116
106
117
107
1. Sign in to the [Azure portal](https://portal.azure.com) with an account with sufficient permissions in the tenant.
118
108
1. Navigate to **Microsoft Entra ID** > **+ New registration**.
119
109
1. In the **Register an application** page, enter your application registration settings:
120
110
1. In **Name**, enter a meaningful name for the app.
121
111
1. In **Supported account types**, select an option that suits your scenario, for example, **Accounts in this organizational directory only (Single tenant)**.
122
-
1. Set the **Redirect URI** to **SPA**, and set the URI. Enter the URI of your API Center portal deployment, in the following form: `https://<service-name>.portal.<location>.azure-api-center.ms`
123
112
1. Select **Register**.
124
113
1. In the left menu, under **Manage**, select **Certificates & secrets**, and then select **+ New client secret**.
125
114
1. Enter a **Description**.
126
115
1. Select an option for **Expires**.
127
116
1. Select **Add**.
128
117
1. Copy the client secret's **Value** before leaving the page. You will need it in the following section.
129
-
1. Optionally, to configure API scopes for your app registration, see [Configure an application to expose a web API](/entra/identity-platform/quickstart-configure-app-expose-web-apis#add-a-scope).
118
+
1. Optionally, add API scopes in your app registration. For more information, see [Configure an application to expose a web API](/entra/identity-platform/quickstart-configure-app-expose-web-apis#add-a-scope).
130
119
131
120
In the following section, you will need the following values from the app registration:
132
121
133
122
* The **Application (client) ID** from the app registration's **Overview** page, and the **Client secret** you copied previously.
134
123
* The following endpoint URLs on the app registration's **Overview** > **Endpoints** page:
135
124
***OAuth2.0 authorization endpoint (v2)** - the authorization endpoint for Microsoft Entra ID
136
125
***OAuth 2.0 token endpoint (v2)** - the token URL endpoint for Microsoft Entra ID
137
-
* Any scopes configured for the app registration.
126
+
* **
127
+
* Any API scopes configured in the app registration.
138
128
139
129
### 2. Add OAuth 2.0 authorization in your API center
140
130
141
-
1. In the [portal](https://azure.microsoft.com), navigate to your key API center.
131
+
1. In the [portal](https://azure.microsoft.com), navigate to your API center.
142
132
1. In the left menu, under **Assets**, select **Authorization (preview)** > **+ Add configuration**.
143
133
1. In the **Add authorization** page, set the values as follows:
144
134
1. Enter a **Title** (name) and optional **Description** for the authorization.
145
135
1. In **Security scheme**, select **OAuth2**.
146
136
1. In **Client ID**, enter the client ID of the app that you created in the previous section.
147
137
1. In **Client secret**, enter the client secret of the app that you created in the previous section.
148
-
1. In **Authorization URL**, enter the OAuth 2.0 authorization endpoint used by the identity provider.
149
-
1. In **Token URL**, enter the OAuth 2.0 token endpoint used by the identity provider.
138
+
1. In **Authorization URL**, enter the OAuth 2.0 authorization endpoint for the identity provider.
139
+
1. In **Token URL**, enter the OAuth 2.0 token endpoint for the identity provider.
150
140
1. In **OAuth2 flow**, select one or both of the OAuth 2.0 flows that you want to use. Available values are **Authorization code (PKCE)** and **Client credentials**.
151
-
1. In **Scopes**, optionally enter one or more API scopes that your API supports. Example: `User.Read`
141
+
1. In **Scopes**, optionally enter one or more API scopes that your API supports, separated by " ". Example: `User.Read`
152
142
1. Select **Create**.
153
143
154
-
## Add authentication settings to an API version
144
+
## Add authentication configuration to an API version
155
145
156
-
After configuring settings for an API key or an OAuth 2.0 flow, add the API key or OAuth 2.0 authentication method to an API version in your inventory.
146
+
After configuring settings for an API key or an OAuth 2.0 flow, add the API key or OAuth 2.0 configuration to an API version in your inventory.
157
147
158
-
1. In the [portal](https://azure.microsoft.com), navigate to your key API center.
148
+
1. In the [portal](https://azure.microsoft.com), navigate to your API center.
159
149
1. In the left menu, under **Assets**, select **APIs**.
160
150
1. Select an API that you want to associate the authorization with.
161
151
1. In the left menu, under **Details**, select **Versions**.
162
-
1. Select the API version that you want to add the authentication settings to.
152
+
1. Select the API version that you want to add the authentication configuration to.
163
153
1. In the left menu, under **Details**, select **Manage Access (preview)** > **+ Add authentication**.
164
154
1. In the **Add authentication** page, select an available **Authentication configuration** that you want to associate with the API version.
165
155
1. Select **Create**.
166
156
167
157
> [!NOTE]
168
-
> You can add multiple authentication settings to an API version. For example, you can add both API key and OAuth 2.0 authentication settings to the same API version. Similarly, you can add the same authentication settings to multiple API versions.
169
-
170
-
## Limit access to specific users or groups
158
+
> You can add multiple authentication configurations to an API version. For example, you can add both API key and OAuth 2.0 configurations to the same API version. Similarly, you can add the same configurations to multiple API versions.
171
159
172
-
You can limit access to the authentication settings associated with an API to specific users or groups in your organization. You do this by configuring an access policy that assigns users or groups the **API Center Credential Access Reader** role, scoped to specific authentication settings in the API. This is useful if you want to allow only specific users to test an API in the API Center portal.
160
+
## Manage access by specific users or groups
173
161
162
+
You can manage access to an API version's authentication configuration by specific users or groups in your organization. You do this by configuring an access policy that assigns users or groups the **API Center Credential Access Reader** role, scoped to specific authentication configurations in the API version. This is useful, for example, if you want to allow only specific users to test an API in the API Center portal.
174
163
175
-
1. In the [portal](https://azure.microsoft.com), navigate to your key API center.
176
-
1. Navigate to an API version to which you've added authentication settings (see previous section).
164
+
1. In the [portal](https://azure.microsoft.com), navigate to your API center.
165
+
1. Navigate to an API version to which you've added an authentication configuration (see previous section).
177
166
1. In the left menu, under **Details**, select **Manage Access (preview)**.
178
-
1. Select the **Edit access policies** dropdown at the end of the row for the authentication settings you want to limit access to.
167
+
1. Select the **Edit access policies** dropdown at the end of the row for the authentication configuration whose access you want to manage.
179
168
1. In the **Manage access** page, select **+ Add > Users** or **+ Add > Groups**.
180
169
1. Search for and select the users (or groups) that you want to add. You can select multiple items.
181
170
1. Click **Select**.
@@ -186,16 +175,24 @@ You can limit access to the authentication settings associated with an API to sp
186
175
## Test API in API Center portal
187
176
188
177
189
-
You can test an API with the authentication and access settings in the API Center portal.
178
+
You can use the API Center portal to test an API that you configured for authentication and user access.
190
179
191
180
1. In the [portal](https://azure.microsoft.com), navigate to your API center.
192
181
1. In the left menu, under **API Center Portal**, select **Portal settings**.
193
182
1. Select **View API Center portal**.
194
-
1. In the API Center portal, select an API that you want to test. Ensure that the API has authentication and access settings associated with it.
183
+
1. In the API Center portal, select an API that you want to test.
184
+
1. Select a version of the API that has an authentication method configured.
185
+
1. Under **Options**, select **View documentation**.
186
+
:::image type="content" source="media/authorize-api-access/view-api-documentation.png" alt-text="Screenshot of API details in API Center portal.":::
187
+
195
188
1. Select an operation in the API, and select **Try this API**.
196
-
1. In the window that opens, review the authentication settings. If you have access to the API, select **Test** to try the API.
189
+
1. In the window that opens, review the authentication settings. If you have access to the API, select **Send** to try the API.
190
+
:::image type="content" source="media/authorize-api-access/test-api-operation-small.png" lightbox="media/authorize-api-access/test-api-operation.png" alt-text="Screenshot of testing an API in the API Center portal's test console.":::
191
+
192
+
1. If the operation is successful, you see the `200 OK` response code and the response body. If the operation fails, you see an error message.
193
+
197
194
198
195
## Related content
199
196
200
197
*[Set up API Center portal](set-up-api-center-portal.md)
201
-
*[Enable and view Azure API Center portal in Visual Studio Code](enable-api-center-portal-vs-code-extension.md)
198
+
*[Enable the Azure API Center portal view in Visual Studio Code](enable-api-center-portal-vs-code-extension.md)
0 commit comments