Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
APPLIES TO: Developer
Policies in Azure API Management provide powerful capabilities that help API publishers address cross-cutting concerns such as authentication, authorization, throttling, caching, and transformation. Policies are a collection of statements that are executed sequentially on the request or response of an API.
This article describes how to debug API Management policies using the Azure API Management Extension for Visual Studio Code.
Create an API Management Developer-tier instance by following this quickstart first.
Install Visual Studio Code and the latest version of Azure API Management Extension for Visual Studio Code.
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.
Important
At this point, the extension will try to initiate and establish a debugging session with the API Management gateway.
When the debugging session is established, the extension will open a new editor that allows us to create and send a test HTTP request to this operation leveraging the REST Client extension.
You will notice the Ocp-Apim-Debug header has already been added to the request. This header is required and the value must be set to the service-level, all-access subscription key to trigger the debugging functionality in the API Management gateway.
Modify the HTTP request in the editor according to your test scenario. Then click send request to send the test request to the API Management gateway.
After the test HTTP request is sent, the extension will open the debugging window showing the effective policies of this operation and stop at the first effective policy.
To follow the policy pipeline, you can single-step through individual policies or set a breakpoint at a policy and step directly to that policy.
In the Variables panel, you can inspect values of system-created and user-created variables. In the Breakpoints panel, you can see the list of all breakpoints that have been set. In the Call Stack panel, you can see the current effective policy scope.
If there is an error during policy execution, you will see the details of the error at the policy where it happened.
Tip
Remember to exit the debug session by clicking the Stop button when you are finished.
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Interactively debug .NET apps with the Visual Studio Code debugger - Training
Learn how to efficiently debug your .NET app by using Visual Studio Code to fix your bugs quickly. Use the interactive debugger within Visual Studio Code to analyze and fix your C# applications.
Certification
Microsoft Certified: Azure Developer Associate - Certifications
Build end-to-end solutions in Microsoft Azure to create Azure Functions, implement and manage web apps, develop solutions utilizing Azure storage, and more.