Skip to content

Commit 5e64f50

Browse files
Merge pull request #289118 from dlepow/apim1023s
[APIM] Subscription key with open-product APIs
2 parents daa9f4e + aa86615 commit 5e64f50

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

articles/api-management/api-management-subscriptions.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: dlepow
66

77
ms.service: azure-api-management
88
ms.topic: conceptual
9-
ms.date: 08/02/2023
9+
ms.date: 09/03/2024
1010
ms.author: danlep
1111
ms.custom: engagement-fy23
1212
---
@@ -133,7 +133,7 @@ After the subscription requirement is disabled, the selected API or APIs can be
133133

134134
When API Management receives an API request from a client with a subscription key, it handles the request according to these rules:
135135

136-
1. Check if it's a valid key associated with an active subscription, either:
136+
1. Check first if it's a valid key associated with an active subscription, either:
137137

138138
* A subscription scoped to the API
139139
* A subscription scoped to a product that's assigned to the API
@@ -142,13 +142,15 @@ When API Management receives an API request from a client with a subscription ke
142142

143143
If a valid key for an active subscription at an appropriate scope is provided, access is allowed. Policies are applied depending on the configuration of the policy definition at that scope.
144144

145+
1. If the key isn't valid but a product exists that includes the API but doesn't require a subscription (an *open* product), ignore the key and handle as an API request without a subscription key (see below).
146+
145147
1. Otherwise, access is denied (401 Access denied error).
146148

147149
### API request without a subscription key
148150

149151
When API Management receives an API request from a client without a subscription key, it handles the request according to these rules:
150152

151-
1. Check first for the existence of a product that includes the API but doesn't require a subscription (an *open* product). If the open product exists, handle the request in the context of the APIs, policies, and access rules configured for the product. An API can be associated with at most one open product.
153+
1. Check first for the existence of a product that includes the API but doesn't require a subscription (an *open* product). If the open product exists, handle the request in the context of the APIs, policies, and access rules configured for the open product. An API can be associated with at most one open product.
152154
1. If an open product including the API isn't found, check whether the API requires a subscription. If a subscription isn't required, handle the request in the context of that API and operation.
153155
1. If no configured product or API is found, then access is denied (401 Access denied error).
154156

@@ -160,16 +162,16 @@ The following table summarizes how the gateway handles API requests with or with
160162
|All products assigned to API require subscription |API requires subscription |API call with subscription key |API call without subscription key | Typical scenarios |
161163
|---------|---------|---------|---------|----|
162164
|✔️ | ✔️ | Access allowed:<br/><br/>• Product-scoped key<br/>• API-scoped key<br/>• All APIs-scoped key<br/>• Service-scoped key<br/><br/>Access denied:<br/><br/>• Other key not scoped to applicable product or API | Access denied | Protected API access using product-scoped or API-scoped subscription |
163-
|✔️ || Access allowed:<br/><br/>• Product-scoped key<br/>• API-scoped key<br/>• All APIs-scoped key<br/>• Service-scoped key<br/><br/>Access denied:<br/><br/>• Other key not scoped to applicable product or API | Access allowed (API context) | • Protected API access with product-scoped subscription<br/><br/>• Anonymous access to API. If anonymous access isn’t intended, configure API-level policies to enforce authentication and authorization. |
165+
|✔️ || Access allowed:<br/><br/>• Product-scoped key<br/>• API-scoped key<br/>• All APIs-scoped key<br/>• Service-scoped key<br/>• Other key not scoped to applicable product or API | Access allowed (API context) | • Protected API access with product-scoped subscription<br/><br/>• Anonymous access to API. If anonymous access isn’t intended, configure API-level policies to enforce authentication and authorization. |
164166
|❌<sup>1</sup> | ✔️ | Access allowed:<br/><br/>• Product-scoped key<br/>• API-scoped key<br/>• All APIs-scoped key<br/>• Service-scoped key<br/><br/>Access denied:<br/><br/>• Other key not scoped to applicable product or API | Access allowed (open product context) | • Protected API access with API-scoped subscription<br/><br/>• Anonymous access to API. If anonymous access isn’t intended, configure with product policies to enforce authentication and authorization |
165-
|❌<sup>1</sup> || Access allowed:<br/><br/>• Product-scoped key<br/>• API-scoped key<br/>• All APIs-scoped key<br/>• Service-scoped key<br/><br/>Access denied:<br/><br/>• Other key not scoped to applicable product or API | Access allowed (open product context) | Anonymous access to API. If anonymous access isn’t intended, configure with product policies to enforce authentication and authorization |
167+
|❌<sup>1</sup> || Access allowed:<br/><br/>• Product-scoped key<br/>• API-scoped key<br/>• All APIs-scoped key<br/>• Service-scoped key<br/>• Other key not scoped to applicable product or API | Access allowed (open product context) | Anonymous access to API. If anonymous access isn’t intended, configure with product policies to enforce authentication and authorization |
166168

167169
<sup>1</sup> An open product exists that's associated with the API.
168170

169171
### Considerations
170172

171173
- API access in a product context is the same, whether the product is published or not. Unpublishing the product hides it from the developer portal, but it doesn’t invalidate new or existing subscription keys.
172-
- Even if a product or API doesn't require a subscription, a valid key from an active subscription that enables access to the product or API can still be used.
174+
- If an API doesn't require subscription authentication, any API request that includes a subscription key is treated the same as a request without a subscription key. The subscription key is ignored.
173175
- API access "context" means the policies and access controls that are applied at a particular scope (for example, API or product).
174176

175177
## Next steps

0 commit comments

Comments
 (0)