Skip to content

Commit 21055b6

Browse files
authored
Merge pull request #206879 from dlepow/mitigate
[APIM] Tracing and subscription key
2 parents 362432d + 6f2dd98 commit 21055b6

15 files changed

+48
-23
lines changed

articles/api-management/api-management-howto-api-inspector.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: dlepow
77
editor: ''
88
ms.service: api-management
99
ms.topic: tutorial
10-
ms.date: 12/10/2021
10+
ms.date: 08/08/2022
1111
ms.author: danlep
1212
ms.custom: devdivchpfy22
1313
---
@@ -32,9 +32,14 @@ In this tutorial, you learn how to:
3232

3333
## Verify allow tracing setting
3434

35-
The **Allow tracing** setting for the subscription used for your API must be enabled. If you're using the built-in all-access subscription, it's enabled by default. To verify in the portal, navigate to your API Management instance and select **Subscriptions**.
35+
To trace request processing, you must enable the **Allow tracing** setting for the subscription used to debug your API. To check in the portal:
36+
37+
1. Navigate to your API Management instance and select **Subscriptions** to review the settings.
3638

3739
:::image type="content" source="media/api-management-howto-api-inspector/allow-tracing-1.png" alt-text="Allow tracing for subscription":::
40+
1. If tracing isn't enabled for the subscription you're using, select the subscription and enable **Allow tracing**.
41+
42+
[!INCLUDE [api-management-tracing-alert](../../includes/api-management-tracing-alert.md)]
3843

3944
## Trace a call
4045

@@ -43,18 +48,21 @@ The **Allow tracing** setting for the subscription used for your API must be ena
4348
1. Select **Demo Conference API** from your API list.
4449
1. Select the **Test** tab.
4550
1. Select the **GetSpeakers** operation.
46-
1. Confirm that the HTTP request header includes **Ocp-Apim-Trace: True** and a valid value for **Ocp-Apim-Subscription-Key**. If it doesn't, select **+ Add header** to add the header.
47-
1. Select **Send** to make an API call.
51+
1. Optionally check the value for the **Ocp-Apim-Subscription-Key** header used in the request by selecting the "eye" icon.
52+
> [!TIP]
53+
> You can override the value of **Ocp-Apim-Subscription-Key** by retrieving a key for another subscription in the portal. Select **Subscriptions**, and open the context menu (**...**) for another subscription. Select **Show/hide keys** and copy one of the keys. You can also regenerate keys if needed. Then, in the test console, select **+ Add header** to add an **Ocp-Apim-Subscription-Key** header with the new key value.
4854
49-
:::image type="content" source="media/api-management-howto-api-inspector/06-debug-your-apis-01-trace-call-1.png" alt-text="Configure API tracing":::
55+
1. Select **Trace**.
5056

51-
> [!TIP]
52-
> If **Ocp-Apim-Subscription-Key** isn't automatically populated in the HTTP request, you can retrieve it in the portal. Select **Subscriptions**, and open the context menu (**...**) for your suscription. Select **Show/hide keys**. You can also regenerate keys if needed. Then, add a key to the header.
57+
* If your subscription doesn't already allow tracing, you're prompted to enable it if you want to trace the call.
58+
* You can also choose to send the request without tracing.
59+
60+
:::image type="content" source="media/api-management-howto-api-inspector/06-debug-your-apis-01-trace-call-1.png" alt-text="Screenshot showing configure API tracing.":::
5361

5462
## Review trace information
5563

5664
1. After the call completes, go to the **Trace** tab in the **HTTP response**.
57-
1. Select any of the following links to jump to detailed trace info: **Inbound**, **Backend**, **Outbound**.
65+
1. Select any of the following links to jump to detailed trace info: **Inbound**, **Backend**, **Outbound**, **On error**.
5866

5967
:::image type="content" source="media/api-management-howto-api-inspector/response-trace-1.png" alt-text="Review response trace":::
6068

@@ -64,10 +72,12 @@ The **Allow tracing** setting for the subscription used for your API must be ena
6472

6573
* **Outbound** - Shows the policies applied to the response before sending back to the caller.
6674

75+
* **On error** - Shows the errors that occurred during the processing of the request and the policies applied to the errors.
76+
6777
> [!TIP]
6878
> Each step also shows the elapsed time since the request is received by API Management.
6979
70-
1. On the **Message** tab, the **ocp-apim-trace-location** header shows the location of the trace data stored in Azure blob storage. If needed, go to this location to retrieve the trace.
80+
1. On the **Message** tab, the **ocp-apim-trace-location** header shows the location of the trace data stored in Azure blob storage. If needed, go to this location to retrieve the trace. Trace data can be accessed for up to 24 hours.
7181

7282
:::image type="content" source="media/api-management-howto-api-inspector/response-message-1.png" alt-text="Trace location in Azure Storage":::
7383
## Next steps

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ description: Learn how to create subscriptions in Azure API Management. A subscr
44
services: api-management
55
documentationcenter: ''
66
author: dlepow
7-
manager: cfowler
8-
editor: ''
97

108
ms.service: api-management
119
ms.workload: mobile
1210
ms.tgt_pltfrm: na
13-
ms.topic: article
14-
ms.date: 11/14/2018
11+
ms.topic: how-to
12+
ms.date: 08/03/2022
1513
ms.author: danlep
1614
---
1715
# Create subscriptions in Azure API Management
@@ -27,17 +25,23 @@ To take the steps in this article, the prerequisites are as follows:
2725
+ [Create an API Management instance](get-started-create-service-instance.md).
2826
+ Understand [subscriptions in API Management](api-management-subscriptions.md).
2927

28+
29+
3030
## Create a new subscription
3131

32-
1. Select **Subscriptions** in the menu on the left.
33-
2. Select **Add subscription**.
34-
3. Provide a name of the subscription and select the scope.
35-
4. Optionally, choose if the subscription should be associated with a user.
36-
5. Select **Save**.
32+
1. Navigate to your API Management instance in the [Azure portal](https://portal.azure.com).
33+
1. In the left menu, under **APIs**, select **Subscriptions** > **Add subscription**.
34+
1. Provide a **Name** and optional **Display name** of the subscription.
35+
1. Optionally, select **Allow tracing** to enable tracing for debugging and troubleshooting APIs. [Learn more](api-management-howto-api-inspector.md)
36+
37+
[!INCLUDE [api-management-tracing-alert](../../includes/api-management-tracing-alert.md)]
38+
1. Select a **Scope** of the subscription from the dropdown list. [Learn more](api-management-subscriptions.md#scope-of-subscriptions)
39+
1. Optionally, choose if the subscription should be associated with a **User** and whether to send a notification for use with the developer portal.
40+
1. Select **Create**.
3741

38-
![Flexible subscriptions](./media/api-management-subscriptions/flexible-subscription.png)
42+
:::image type="content" source="media/api-management-howto-create-subscriptions/create-subscription.png" alt-text="Screenshot showing how to create an API Management subscription in the portal.":::
3943

40-
After you create the subscription, two API keys are provided to access the APIs. One key is primary, and one is secondary.
44+
After you create the subscription, it appears in the list on the **Subscriptions** page. Two API keys are provided to access the APIs. One key is primary, and one is secondary.
4145

4246
## Next steps
4347
Get more information on API Management:

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ In these cases, you don't need to create a product and add APIs to it first.
6363

6464
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.
6565

66+
> [!WARNING]
67+
> The all-access subscription enables access to every API in the API Management instance and should only be used by authorized users. Never use this subscription for routine API access or embed the all-access subscription key in client apps.
68+
6669
> [!NOTE]
6770
> 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.
6871
@@ -76,9 +79,7 @@ Creating a subscription without assigning an owner makes it a standalone subscri
7679

7780
## Create subscriptions in Azure portal
7881

79-
API publishers can [create subscriptions](api-management-howto-create-subscriptions.md) directly in the Azure portal:
80-
81-
![Flexible subscriptions](./media/api-management-subscriptions/flexible-subscription.png)
82+
API publishers can [create subscriptions](api-management-howto-create-subscriptions.md) directly in the Azure portal.
8283

8384
## How API Management handles requests with or without subscription keys
8485

-61.1 KB
Loading
30.7 KB
Loading
Binary file not shown.
-58.7 KB
Loading

0 commit comments

Comments
 (0)