Skip to content

Commit cafee5d

Browse files
author
gitName
committed
review
1 parent 28d8056 commit cafee5d

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

articles/api-management/api-management-debug-policies.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,18 @@ Azure API Management policies are a sequence of statements that address cross-cu
2828
* [GitHub Copilot for Azure extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azure-github-copilot) - to create and explain policies
2929
* [REST Client extension](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) - to debug policies
3030

31-
<!-- Assume we need a step to install GH Copilot ext? -->
32-
3331
* An API Management instance. If you need to create one, see this [quickstart](vscode-create-service-instance.md).
3432

35-
<!-- Still can't use extension to create instance in v2 tiers? -->
36-
3733
* Import an API to your API Management instance. For example steps, see [Tutorial: Use the API Management Extension for Visual Studio Code to import and manage APIs](visual-studio-code-tutorial.md).
3834

3935
## Restrictions and limitations
4036

41-
* Policy debugging is currently supported in the API Management Developer tier
37+
* Policy debugging is currently supported only in the API Management Developer tier.
4238

43-
* Policy debugging uses the built-in (service-level) all-access subscription (display name "Built-in all-access subscription") and enables tracing for the duration of the debugging session.
39+
* Policy debugging uses the built-in (service-level) all-access subscription (display name "Built-in all-access subscription"). You must be a service owner to use this subscription.
4440

45-
## Create policies using GitHub Copilot
41+
## Create a policy using GitHub Copilot
42+
4643
The Azure API Management extension integrates with GitHub Copilot for Azure to help you create a draft of a policy. With AI assistance, create and edit policies in a user-friendly way.
4744

4845
To create a policy:
@@ -52,6 +49,8 @@ To create a policy:
5249
1. Select the policy scope that you want to work with.
5350
* To create a policy that applies to all APIs in the instance, select **Global Policy**.
5451
* To create a policy that applies to a specific API, under **APIs**, select the API, and then select **Policy**.
52+
* To create a policy that applies to a specific API operation, select the operation, and then select **Policy**.
53+
5554
1. In the policy editor window that appears, right-click and select **Copilot** > **Draft APIM Policies**. The Copilot Chat window appears.
5655
1. In the Copilot Chat window, enter a prompt in natural language to create a policy. Examples:
5756

@@ -60,7 +59,7 @@ To create a policy:
6059
```
6160
6261
```copilot-prompt
63-
@azure Create a policy that sets the backend URL to https://mybackend.contoso.com and adds a header to the request
62+
@azure Create a policy that sets the backend URL to https://mybackend.contoso.com and adds a custom header to the request
6463
```
6564
1. Copilot generates a policy draft in the chat window. You can refine the prompt if you want Copilot to change the output.
6665
@@ -82,6 +81,8 @@ To receive an explanation:
8281
1. Select the policy scope that you want to work with.
8382
* To explain a policy that applies to all APIs in the instance, select **Global Policy**.
8483
* To explain a policy that applies to a specific API, under **APIs**, select the API, and then select **Policy**.
84+
* To explain a policy that applies to a specific API operation, select the operation, and then select **Policy**.
85+
8586
1. In the policy editor window that appears, right-click and select **Copilot** > **Explain APIM Policies**.
8687
1. An overview and explanation of policies in the policy XML document are generated in the Copilot Chat window.
8788
@@ -98,12 +99,12 @@ The Azure API Management extension for Visual Studio Code provides a debugging e
9899
4. Select the API and operation to debug.
99100
5. Right click on the operation and select **Start Policy Debugging**.
100101
101-
At this point, the extension starts to establish a debugging session with the API Management gateway. Check the progress in the **Debug Console** windows.
102+
At this point, the extension starts to establish a debugging session with the API Management gateway. Check the progress in the **Debug Console** window.
102103
103104
:::image type="content" source="media/api-management-debug-policies/initiate-debugging-session.png" alt-text="Screenshot if initiating a policy debugging session in Visual Studio Code.":::
104105
105106
> [!NOTE]
106-
> Starting a debugging session also enables request tracing during the session, to help you diagnose and solve issues.
107+
> Starting a debugging session also enables request tracing for the duration of the session, to help you diagnose and solve issues.
107108
108109
### Send a test request
109110
@@ -117,7 +118,8 @@ Modify the HTTP request in the editor according to your test scenario. Then clic
117118
:::image type="content" source="media/api-management-debug-policies/rest-client.png" alt-text="Screenshot of sending a test request in Visual Studio Code.":::
118119
119120
### Debug policies
120-
After the test HTTP request is sent, the extension opens the debugging window, which shows the effective policies of this operation and stop at the first effective policy.
121+
122+
After the test HTTP request is sent, the extension opens the debugging window, which shows the effective policies of this operation and stops at the first effective policy.
121123
122124
:::image type="content" source="media/api-management-debug-policies/main-window.png" alt-text="Screenshot of the debugging window in Visual Studio Code.":::
123125
@@ -129,12 +131,12 @@ To follow the policy pipeline, you can single-step through individual policies o
129131
130132
If there is an error during policy execution, you will see the details of the error at the policy where it happened.
131133
132-
:::image type="content" source="media/api-management-debug-policies/exception.png" alt-text="Screenshot of a policy exception in Visual Studio Code.":::
134+
Exit the debugging session by clicking the **Stop** button when you are finished.
133135
134-
To review the request trace, select the value of the `Ocp-Apim-Trace-Location` header that is provided in the HTTP response.
136+
:::image type="content" source="media/api-management-debug-policies/exception.png" alt-text="Screenshot of a policy exception in Visual Studio Code.":::
135137
136138
> [!TIP]
137-
> Exit the debugging session by clicking the **Stop** button when you are finished.
139+
> To review the request trace, select the value of the `Ocp-Apim-Trace-Location` header that is provided in the HTTP response.
138140
139141
## Related content
140142

0 commit comments

Comments
 (0)