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-management/api-management-subscriptions.md
+52-8Lines changed: 52 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,9 @@ author: dlepow
7
7
8
8
ms.service: api-management
9
9
ms.topic: conceptual
10
-
ms.date: 09/27/2022
10
+
ms.date: 12/16/2022
11
11
ms.author: danlep
12
+
ms.custom: engagement-fy23
12
13
---
13
14
# Subscriptions in Azure API Management
14
15
@@ -81,29 +82,72 @@ Creating a subscription without assigning an owner makes it a standalone subscri
81
82
* Manually share the subscription key.
82
83
* Use a custom system to make the subscription key available to your team.
83
84
84
-
## Create subscriptions in Azure portal
85
+
## Create and manage subscriptions in Azure portal
85
86
86
87
API publishers can [create subscriptions](api-management-howto-create-subscriptions.md) directly in the Azure portal.
87
88
88
-
## How API Management handles requests with or without subscription keys
89
+
When created in the portal, a subscription is in the **Active** state, meaning a subscriber can call an associated API using a valid subscription key. You can change the state of the subscription as needed - for example, you can suspend, cancel, or delete the subscription to prevent API access.
90
+
91
+
## Enable or disable subscription requirement for API or product access
89
92
90
-
By default, a developer can only access a product or API by using a subscription key. Under certain scenarios, API publishers might want to publish a product or a particular API to the public without the requirement of subscriptions. While a publisher could choose to enable unsecured access to certain APIs, configuring another mechanism to secure client access is recommended.
93
+
By default when you create an API, a subscription key is required for API access. Similarly, when you create a product, by default a subscription key is required to access any API that's added to the product. Under certain scenarios, an API publisher might want to publish a product or a particular API to the public without the requirement of subscriptions. While a publisher could choose to enable unsecured (anonymous) access to certain APIs, configuring another mechanism to secure client access is recommended.
91
94
92
95
> [!CAUTION]
93
96
> Use care when configuring a product or an API that doesn't require a subscription. This configuration may be overly permissive and may make an API more vulnerable to certain [API security threats](mitigate-owasp-api-threats.md#security-misconfiguration).
94
97
98
+
You can disable the subscription requirement at the time you create an API or product, or at a later date.
99
+
95
100
To disable the subscription requirement using the portal:
96
101
97
-
***Disable requirement for product** - Disable **Requires subscription** on the **Settings** page of the product.
98
-
***Disable requirement for API** - Disable **Subscription required** on the **Settings** page of the API.
102
+
***Disable requirement for product** - On the **Settings** page of the product, disable **Requires subscription**
103
+
***Disable requirement for API** - In the **Settings** page of the API, disable **Subscription required**.
104
+
105
+
After the subscription requirement is disabled, the selected API or APIs can be accessed without a subscription key.
106
+
107
+
## How API Management handles requests with or without subscription keys
108
+
109
+
### API request with a subscription key
110
+
111
+
When API Management receives an API request from a client with a subscription key, it handles the request according to these rules:
112
+
113
+
1. Check if it's a valid key associated with an active subscription, either:
114
+
115
+
* A subscription scoped to the API
116
+
* A subscription scoped to a product that's assigned to the API
117
+
* A subscription scoped to all APIs
118
+
* The service-scoped subscription (built-in all access subscription)
99
119
100
-
After the subscription requirement is disabled, the selected API or APIs can be accessed without a subscription key.
120
+
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.
121
+
122
+
1. Otherwise, access is denied (401 Access denied error).
123
+
124
+
### API request without a subscription key
101
125
102
126
When API Management receives an API request from a client without a subscription key, it handles the request according to these rules:
103
127
104
128
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.
105
129
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.
106
-
1. If no configured product or API is found, then access is denied.
130
+
1. If no configured product or API is found, then access is denied (401 Access denied error).
131
+
132
+
### Summary table
133
+
134
+
The following table summarizes how the gateway handles API requests with or without subscription keys in different scenarios. Configurations that could potentially enable unintended, anonymous API access are noted.
135
+
136
+
137
+
|All products assigned to API require subscription |API requires subscription |API call with subscription key |API call without subscription key | Typical scenarios |
138
+
|---------|---------|---------|---------|----|
139
+
|✔️ | ✔️ | 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 |
140
+
|✔️ | ❌ | 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. |
141
+
|❌<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 |
142
+
|❌<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 |
143
+
144
+
<sup>1</sup> An open product exists.
145
+
146
+
### Considerations
147
+
148
+
- 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.
149
+
- 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.
150
+
- API access "context" means the policies and access controls that are applied at a particular scope (for example, API or product).
0 commit comments