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
API Management is introducing built-in OAuth 2.0 application-based access to products using the client credentials flow.
19
+
API Management is introducing built-in OAuth 2.0 application-based access to products using the client credentials flow. API managers and developers can use applications to simplify secure OAuth 2.0-based access to APIs managed in API Management.
20
20
21
-
With this feature, an API manager configures an application in Microsoft Entra ID to represent a product, and registers a client application in Microsoft Entra ID that restricts access to the product's APIs. A developer (or client app) can then use the OAuth 2.0 client credentials flow to obtain OAuth tokens from the client application that are passed to the API Management gateway for authorization to the product's APIs.
21
+
With this feature, an API manager configures an application in Microsoft Entra ID to represent a product, and registers a client application in Microsoft Entra ID that restricts access to the product's APIs. Developers obtain credentials from the developer portal to generate OAuth 2.0 tokens from Microsoft Entra ID. A developer (or client app) can then use the OAuth 2.0 client credentials flow to obtain OAuth 2.0 tokens that are passed to the API Management gateway for authorization to the product's APIs.
22
22
23
23
> [!NOTE]
24
24
> This feature is in private preview. Ensure that you have received instructions to access the preview and that your subscription allows you to create an API Management instance in an Early Updates Access Program (EUAP) region. See detailed [Prerequisites](#prerequisites).
@@ -28,8 +28,9 @@ This article describes the following steps:
28
28
29
29
* Enable application-based access for a product in API Management.
30
30
* Create a client application in API Management that restricts access to the product.
31
+
* View the client application in the developer portal and get credentials to the product's APIs.
31
32
* Test OAuth 2.0 token-based access the product's associated API.
32
-
* View the client application in the developer portal and get secure access to the product's APIs.
33
+
33
34
34
35
<!-- Clarify personas
35
36
This feature enables:
@@ -75,7 +76,7 @@ This feature enables:
75
76
76
77
1. Assign the identity the **Application Administrator** RBAC role in Microsoft Entra ID. To assign the role:
77
78
78
-
1. Sign in to the portal and navigate to **Microsoft Entra**
79
+
1. Sign in to the portal and navigate to **Microsoft Entra ID**.
79
80
1. In the left menu, select **Manage** > **Roles and administrators**.
80
81
1. Select **Application administrator**.
81
82
1. In the left menu, select **Manage** > **Assignments** > **+ Add assignments**.
@@ -84,7 +85,9 @@ This feature enables:
84
85
85
86
## Enable application based access for product
86
87
87
-
Follow these steps to enable **Application based access** for a product. Enabling this setting automatically creates an application in Microsoft Entra ID to represent the selected product.
88
+
Follow these steps to enable **Application based access** for a product. Enabling this setting automatically creates an application in Microsoft Entra ID to represent the selected product.
89
+
90
+
The following example uses the **Starter** product, but choose any published product that has at least one API assigned to it.
88
91
89
92
90
93
1. Sign in to the [Azure portal](https://portal.azure.com) and navigate to your API Management instance.
@@ -101,14 +104,15 @@ Follow these steps to enable **Application based access** for a product. Enablin
101
104
102
105
## Review product application settings
103
106
104
-
After you enable application based access, an enterprise application is created.
107
+
Enabling application based access create an enterprise application in Microsoft Entra ID to represent the product.
105
108
106
-
The application is named with the following format: **APIMProductApplication<product-name>**. For example, if the product name is **Starter**, the application name is **APIMProductApplicationStarter**. The application should have an **App role** defined.
109
+
The application is named with the following format: **APIMProductApplication<product-name>**. For example, if the product name is **Starter**, the application name is **APIMProductApplicationStarter**. The application has an **App role** defined.
107
110
108
111
You can review application settings in **App registrations**.
109
112
110
-
1. Sign in to the Azure portal and navigate to **App registrations**.
111
-
1. Select **All applications** and search for the application created by API Management.
113
+
1. Sign in to the Azure portal and navigate to **Microsoft Entra ID** > **Manage** > **App registrations**.
114
+
1. Select **All applications**.
115
+
1. Search for and select the application created by API Management.
112
116
1. In the left menu, under **Manage**, select **App roles**.
113
117
1. Confirm that an application role was set by Azure API Management, as shown in the following screenshot:
114
118
@@ -118,11 +122,14 @@ You can review application settings in **App registrations**.
118
122
119
123
Now create a client application that will be registered in Microsoft Entra ID and restricts to access one or more products.
120
124
121
-
*Products must have **Application based access** enabled to be associated with a client application.
122
-
* Each client application is associated with a single user (owner) in the API Management instance.
125
+
*A product must have **Application based access** enabled to be associated with the client application.
126
+
* Each client application has a single user (owner) in the API Management instance that can access product APIs through the application.
123
127
* A product can be associated with more than one client application.
124
128
125
-
1. Sign in to the Azure portal at the following URL (`https://portal.azure.com/?showversion=true&feature.customPortal=false&Microsoft_Azure_ApiManagement=javierbo2&applicationNewRoleValueFormat=true`) and navigate to your API Management instance.
129
+
1. Sign in to the Azure portal at the following test URL:
1. In the left menu, under **APIs**, select **Applications** > **+ Register application**.
127
134
1. In the **Register an application** pane, enter the following application settings:
128
135
***Name**: Enter a name for the application.
@@ -133,40 +140,44 @@ Now create a client application that will be registered in Microsoft Entra ID an
133
140
:::image type="content" source="media/applications/register-application.png" alt-text="Screenshot of application settings in the portal.":::
134
141
1. Select **Register**.
135
142
136
-
The application is added to the list of applications on the Applications pane. A client secret is automatically generated for the application. The client secret is used to obtain an OAuth token from the client application in the client credentials flow.
143
+
The application is added to the list of applications on the **Applications** pane. A client secret is automatically generated for the application. The client secret is used to obtain an OAuth token from the client application in the client credentials flow.
137
144
138
145
<!-- Where would client secret show? Should customer store it somewhere? -->
139
146
140
147
## Review client application settings
141
148
142
149
Review the settings for the client application in Microsoft Entra ID.
143
150
144
-
The application is named with the following format: **xxxxxxTBD**. For example, if the product name is **Starter**, the application name is **APIMProductApplicationStarter**. The application should have an **App role** defined.
145
-
151
+
The application is named with the following format: **APIMApplication<product-name>**. For example, if the product name is **Starter**, the application name is similar to **APIMApplicationStarter**.
146
152
You can review application settings in **App registrations**.
147
153
148
-
1. Sign in to the Azure portal and navigate to **App registrations**.
149
-
1. Select **All applications** and search for the application created by API Management.
150
-
1. In the left menu, under **Manage**, select **App roles**.
151
-
1. Confirm that an application role was set by Azure API Management, as shown in the following screenshot:
154
+
1. Sign in to the Azure portal and navigate to **Microsoft Entra ID** > **Manage** > **App registrations**.
155
+
1. Select **All applications**.
156
+
1. Search for and select the client application created by API Management.
157
+
1. In the left menu, under **Manage**, select **API permissions**.
158
+
1. Confirm that the application has permissions to access the backend product applications.
159
+
160
+
For example, if the client application grants access to the **Starter** product, the application has **Product.Starter.All** permissions to access the **APIMProductApplicationStarter** application.
161
+
162
+
<!-- Insert screenshot -->
152
163
153
164
154
165
## Create token and use with API call
155
166
156
167
157
-
Run the following Azure PowerShell scripts to obtain a token generated for the client application and to call a product API using the token.
168
+
Run the following Azure PowerShell scripts to call the client application to generate a token, then use the token to call a product API in API Management.
158
169
159
170
<!-- Warn about secure handling of token and secrets -->
160
171
161
-
### Obtain token for client application
172
+
### Call client application to generate token
162
173
```powershell
163
174
164
175
# Replace placeholder values with your own values.
165
176
166
-
$clientId = "aa8029d8-83a5-4713-939d-cebac1bbd672" # Client (application) ID of client application
167
-
$clientSecret = "xxxxx" # Retrieve secret of client application in developer portal
168
-
$scopeOfOtherApp = "api://03db2e9e-efe9-4f68-b74d-911966d1a684/.default" # Audience of application audience is visible under a product
169
-
$tenantId = "e74bd0b5-f803-4e01-858b-dba7e58e55cf" # Your tenant id
177
+
$clientId = "00001111-aaaa-2222-bbbb-3333cccc4444" # Client (application) ID of client application
178
+
$clientSecret = "******" # Retrieve secret of client application in developer portal
179
+
$scopeOfOtherApp = "api://055556666-ffff-7777-aaaa-8888bbbb9999/.default" # Value of Audience in product properties
180
+
$tenantId = "aaaabbbb-0000-cccc-1111-dddd2222eeee" # Your tenant id
170
181
171
182
$body = @{
172
183
grant_type = "client_credentials"
@@ -181,7 +192,7 @@ $token
181
192
182
193
### Call product API using token
183
194
184
-
The token generated in the previous step is used to call a product API. The token is passed in the **Authorization** header of the request. The API Management instance validates the token and authorizes access to the API.
195
+
The token generated in the previous step is used to call a product API. The token is passed in the **Authorization** header of the request. The API Management instance validates the token and authorizes access to the API. The following is an example call to the echo API.
185
196
186
197
```powershell
187
198
@@ -200,11 +211,13 @@ Write-Host "Response:"
200
211
$getresponse | ConvertTo-Json -Depth 5
201
212
```
202
213
203
-
204
214
## List applications and get secrets in the developer portal
205
215
216
+
[TBD]
217
+
206
218
207
219
## Related content
208
220
209
-
* Add link here
221
+
*[Create and publish a product](api-management-howto-add-products.md)
222
+
*[Authentication and authorization to APIs in API Management](authentication-authorization-overview.md)
0 commit comments