Skip to content

Commit 6c7409c

Browse files
authored
Merge pull request #184376 from dlepow/apimopen
[APIM] Conceptual updates for subscriptions and products
2 parents 5d70eca + f547410 commit 6c7409c

File tree

2 files changed

+67
-40
lines changed

2 files changed

+67
-40
lines changed

articles/api-management/api-management-howto-add-products.md

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@ description: In this tutorial, you create and publish a product in Azure API Man
55
author: dlepow
66
ms.service: api-management
77
ms.topic: tutorial
8-
ms.date: 12/15/2021
8+
ms.date: 01/18/2022
99
ms.author: danlep
1010
ms.custom: devdivchpfy22
1111

1212
---
1313
# Tutorial: Create and publish a product
1414

15-
In Azure API Management, a [*product*](api-management-terminology.md#term-definitions) contains one or more APIs, a usage quota, and the terms of use. After a product is published, developers can subscribe to the product and begin to use the product's APIs.
15+
In Azure API Management, a [*product*](api-management-terminology.md#term-definitions) contains one or more APIs, a usage quota, and the terms of use. After a product is published, developers can [subscribe](api-management-subscriptions.md) to the product and begin to use the product's APIs.
1616

1717
In this tutorial, you learn how to:
1818

1919
> [!div class="checklist"]
2020
> * Create and publish a product
2121
> * Add an API to the product
22+
> * Access product APIs
2223
2324
:::image type="content" source="media/api-management-howto-add-products/added-product-1.png" alt-text="API Management products in portal":::
2425

@@ -46,12 +47,12 @@ In this tutorial, you learn how to:
4647
|--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
4748
| Display name | The name as you want it to be shown in the [developer portal](api-management-howto-developer-portal.md). |
4849
| Description | Provide information about the product such as its purpose, the APIs it provides access to, and other details. |
49-
| Published | Select **Published** if you want to publish the product. Before the APIs in a product can be called, the product must be published. By default, new products are unpublished, and are visible only to the **Administrators** group. |
50-
| Requires subscription | Select if a user is required to subscribe to use the product. |
50+
| State | Select **Published** if you want to publish the product. Before the APIs in a product can be called, the product must be published. By default, new products are unpublished, and are visible only to the **Administrators** group. |
51+
| Requires subscription | Select if a user is required to subscribe to use the product (the product is *protected*) and a subscription key must be used to access the product's APIs. If a subscription isn't required (the product is *open*), a subscription key isn't required to access the product's APIs. See [Access to product APIs](#access-to-product-apis) later in this article. |
5152
| Requires approval | Select if you want an administrator to review and accept or reject subscription attempts to this product. If not selected, subscription attempts are auto-approved. |
52-
| Subscription count limit | Optionally, limit the count of multiple simultaneous subscriptions. |
53-
| Legal terms | You can include the terms of use for the product, which subscribers must accept to use the product. |
54-
| APIs | Select one or more APIs. You can also add APIs after creating the product. For more information, see [Add APIs to a product](#add-apis-to-a-product) later in this article. |
53+
| Subscription count limit | Optionally limit the count of multiple simultaneous subscriptions. |
54+
| Legal terms | You can include the terms of use for the product which subscribers must accept in order to use the product. |
55+
| APIs | Select one or more APIs. You can also add APIs after creating the product. For more information, see [Add APIs to a product](#add-apis-to-a-product) later in this article. <br/><br/>If the product is open (doesn't require a subscription), you can only add an API that isn't associated with another open product. |
5556

5657
1. Select **Create** to create your new product.
5758

@@ -77,7 +78,7 @@ You can specify various values for your product:
7778
| `--product-name` | The name as you want it to be shown in the [developer portal](api-management-howto-developer-portal.md). |
7879
| `--description` | Provide information about the product such as its purpose, the APIs it provides access to, and other details. |
7980
| `--state` | Select **published** if you want to publish the product. Before the APIs in a product can be called, the product must be published. By default, new products are unpublished, and are visible only to the **Administrators** group. |
80-
| `--subscription-required` | Select if a user is required to subscribe to use the product. |
81+
| `--subscription-required` | Select if a user is required to subscribe to use the product (the product is *protected*) or a subscription isn't required (the product is *open*). See [Access to product APIs](#access-to-product-apis) later in this article. |
8182
| `--approval-required` | Select if you want an administrator to review and accept or reject subscription attempts to this product. If not selected, subscription attempts are auto-approved. |
8283
| `--subscriptions-limit` | Optionally, limit the count of multiple simultaneous subscriptions.|
8384
| `--legal-terms` | You can include the terms of use for the product, which subscribers must accept to use the product. |
@@ -115,8 +116,6 @@ Continue configuring the product after saving it. In your API Management instanc
115116

116117
Products are associations of one or more APIs. You can include many APIs and offer them to developers through the developer portal. During the product creation, you can add one or more existing APIs. You can also add APIs to the product later, either from the Products **Settings** page or while creating an API.
117118

118-
Developers must first subscribe to a product to get access to the API. When they subscribe, they get a subscription key that is good for any API in that product. If you created the API Management instance, you're an administrator already, so you're subscribed to every product by default.
119-
120119
### Add an API to an existing product
121120

122121
### [Portal](#tab/azure-portal)
@@ -162,8 +161,26 @@ az apim product api delete --resource-group apim-hello-word-resource-group \
162161

163162
---
164163

165-
> [!TIP]
166-
> You can create or update a user's subscription to a product with custom subscription keys through a [REST API](/rest/api/apimanagement/current-ga/subscription/create-or-update) or PowerShell command.
164+
## Access to product APIs
165+
166+
After you publish a product, developers can access the APIs. Depending on how the product is configured, they may need to subscribe to the product for access.
167+
168+
* **Protected product** - Developers must first subscribe to a protected product to get access to the product's APIs. When they subscribe, they get a subscription key that can access any API in that product. If you created the API Management instance, you are an administrator already, so you are subscribed to every product by default. For more information, see [Subscriptions in Azure API Management](api-management-subscriptions.md).
169+
170+
When a client makes an API request with a valid product subscription key, API Management processes the request and permits access in the context of the product. Policies and access control rules configured for the product can be applied.
171+
172+
> [!TIP]
173+
> You can create or update a user's subscription to a product with custom subscription keys through a [REST API](/rest/api/apimanagement/current-ga/subscription/create-or-update) or PowerShell command.
174+
175+
* **Open product** - Developers can access an open product's APIs without a subscription key. However, you can configure other mechanisms to secure client access to the APIs, including [OAuth 2.0](api-management-howto-protect-backend-with-aad.md), [client certificates](api-management-howto-mutual-certificates-for-clients.md), and [restricting caller IP addresses](./api-management-access-restriction-policies.md#RestrictCallerIPs).
176+
177+
When a client makes an API request without a subscription key:
178+
179+
* API Management checks whether the API is associated with an open product.
180+
181+
* If the open product exists, it then processes the request in the context of that open product. Policies and access control rules configured for the open product can be applied.
182+
183+
For more information, see [How API Management handles requests with or without subscription keys](api-management-subscriptions.md#how-api-management-handles-requests-with-or-without-subscription-keys).
167184

168185
## Next steps
169186

@@ -172,6 +189,7 @@ In this tutorial, you learned how to:
172189
> [!div class="checklist"]
173190
> * Create and publish a product
174191
> * Add an API to the product
192+
> * Access product APIs
175193
176194
Advance to the next tutorial:
177195

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
---
22
title: Subscriptions in Azure API Management | Microsoft Docs
3-
description: Learn about the concept of subscriptions in Azure API Management. Consumers get access to APIs by using subscriptions in Azure API Management.
3+
description: Learn about the concept of subscriptions in Azure API Management. Consumers commonly get access to APIs by using subscriptions in Azure API Management.
44
services: api-management
55
documentationcenter: ''
66
author: dlepow
7-
manager: cfowler
8-
editor: ''
97

108
ms.service: api-management
11-
ms.workload: mobile
12-
ms.tgt_pltfrm: na
13-
ms.topic: article
14-
ms.date: 11/22/2021
9+
ms.topic: conceptual
10+
ms.date: 01/05/2022
1511
ms.author: danlep
1612
---
1713
# Subscriptions in Azure API Management
@@ -20,13 +16,14 @@ In Azure API Management, *subscriptions* are the most common way for API consume
2016

2117
## What are subscriptions?
2218

23-
By publishing APIs through API Management, you can easily secure API access using subscription keys. Consume the published APIs by including a valid subscription key in the HTTP requests when calling to those APIs. Without a valid subscription key, the calls will:
24-
* Be rejected immediately by the API Management gateway.
25-
* Not be forwarded to the back-end services.
19+
By publishing APIs through API Management, you can easily secure API access using subscription keys. Developers who need to consume the published APIs must include a valid subscription key in HTTP requests when calling those APIs. Without a valid subscription key, the calls are:
20+
* Rejected immediately by the API Management gateway.
21+
* Not forwarded to the back-end services.
2622

2723
To access APIs, you'll need a subscription and a subscription key. A *subscription* is a named container for a pair of subscription keys.
2824

29-
Regularly regenerating keys is a common security precaution, so most Azure products requiring a subscription key will generate keys in pairs. Each application using the service can switch from *key A* to *key B* and regenerate key A with minimal disruption, and vice versa.
25+
> [!NOTE]
26+
> Regularly regenerating keys is a common security precaution. Like most Azure services requiring a subscription key, API Management generates keys in pairs. Each application using the service can switch from *key A* to *key B* and regenerate key A with minimal disruption, and vice versa.
3027
3128
In addition,
3229

@@ -41,57 +38,69 @@ In addition,
4138
4239
## Scope of subscriptions
4340

44-
Subscriptions can be associated with various scopes: product, all APIs, or an individual API.
41+
Subscriptions can be associated with various scopes: [product](api-management-howto-add-products.md), all APIs, or an individual API.
4542

4643
### Subscriptions for a product
4744

48-
Traditionally, subscriptions in API Management were associated with a single [API product](api-management-terminology.md) scope. Developers:
45+
Traditionally, subscriptions in API Management were associated with a single [product](api-management-terminology.md) scope. Developers:
4946
* Found the list of products on the developer portal.
5047
* Submitted subscription requests for the products they wanted to use.
5148
* Use the keys in those subscriptions (approved either automatically or by API publishers) to access all APIs in the product.
52-
* You can access APIs with or without the subscription key regardless of subscription scope (product, global, or API).
5349

5450
Currently, the developer portal only shows the product scope subscriptions under the **User Profile** section.
5551

5652
![Product subscriptions](./media/api-management-subscriptions/product-subscription.png)
5753

58-
> [!TIP]
59-
> Under certain scenarios, API publishers might want to publish an API product to the public without the requirement of subscriptions. They can deselect the **Require subscription** option on the **Settings** page of the product in the Azure portal. As a result, all APIs under the product can be accessed without an API key.
60-
6154
### Subscriptions for all APIs or an individual API
6255

63-
With the addition of the [Consumption](https://aka.ms/apimconsumptionblog) tier of API Management, subscription key management is more streamlined.
64-
65-
#### Two more subscription scopes
66-
67-
Subscription scopes aren't limited to an API product. You can create keys that grant access to either:
68-
* a single API, or
56+
You can also create keys that grant access to either:
57+
* A single API, or
6958
* All APIs within an API Management instance.
7059

71-
You don't need to create a product before adding APIs to it.
60+
In these cases, you don't need to create a product and add APIs to it first.
61+
62+
### All-access subscription
7263

7364
Each API Management instance comes with an immutable, all-APIs subscription (also called an *all-access* subscription). This built-in subscription makes it straightforward to test and debug APIs within the test console.
7465

7566
> [!NOTE]
76-
> If you're using an API-scoped subscription or the all-access subscription, any [policies](api-management-howto-policies.md) configured at the product scope aren't applied to that subscription.
67+
> If you're using an API-scoped subscription or the all-access subscription, any [policies](api-management-howto-policies.md) configured at the product scope aren't applied to requests from that subscription.
7768
78-
#### Standalone subscriptions
69+
### Standalone subscriptions
7970

80-
API Management now allows *standalone* subscriptions. You no longer need to associate subscriptions with a developer account. This feature proves useful in scenarios similar to several developers or teams sharing a subscription.
71+
API Management also allows *standalone* subscriptions, which are not associated with a developer account. This feature proves useful in scenarios similar to several developers or teams sharing a subscription.
8172

8273
Creating a subscription without assigning an owner makes it a standalone subscription. To grant developers and the rest of your team access to the standalone subscription key, either:
8374
* Manually share the subscription key.
8475
* Use a custom system to make the subscription key available to your team.
8576

86-
#### Creating subscriptions in Azure portal
77+
## Create subscriptions in Azure portal
8778

8879
API publishers can [create subscriptions](api-management-howto-create-subscriptions.md) directly in the Azure portal:
8980

9081
![Flexible subscriptions](./media/api-management-subscriptions/flexible-subscription.png)
9182

83+
## How API Management handles requests with or without subscription keys
84+
85+
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.
86+
87+
To disable the subscription requirement using the portal:
88+
89+
* **Product** - Disable **Requires subscription** on the **Settings** page of the product.
90+
* **API** - Disable **Subscription required** on the **Settings** page of the API.
91+
92+
After disabling the subscription requirement, the selected API or APIs can be accessed without a subscription key.
93+
94+
When API Management receives an API request from a client without a subscription key, it handles the request according to these rules:
95+
96+
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.
97+
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.
98+
1. If no configured product or API is found, then access is denied.
99+
92100
## Next steps
93101
Get more information on API Management:
94102

103+
+ Learn how API Management [policies](set-edit-policies.md#configure-scope) get applied at different scopes.
95104
+ Learn other [concepts](api-management-terminology.md) in API Management.
96105
+ Follow our [tutorials](import-and-publish.md) to learn more about API Management.
97106
+ Check our [FAQ page](api-management-faq.yml) for common questions.

0 commit comments

Comments
 (0)