This blog post is a no-nonsense guide to acquire a Request Trace in Azure API Management. A Request Trace is a JSON document that contains valuable information about a request/response sent to API’s exposed through Azure API Management. You can use the Request Trace for debugging and troubleshooting your APIs.
You need to Allow tracing in your API subscriptions in order to obtain a request trace.
Request traces might contain confidential information (like API keys and tokens), so handle your request traces with care.
You can obtain the Request Trace in two easy steps.
Add this header to your HTTP request:
Your HTTP response now contains a response header called Ocp-Apim-Trace-Location:
Ocp-Apim-Trace-Location: https://apimXXXYYYZZZ.blob.core.windows.net/apiinspectorcontainer/XXXYYYZXZZThe value of this header is the URL to the actual Request Trace.
A request trace is a JSON document that consists of trace-information collected through an API request. This JSON document is divided into ‘request trace sections’ and ‘request trace log entries’.
Request trace sections (sometimes also referred to as policy sections): “inbound”, “backend”, and “output”.
Each ‘request trace section’ contains an array of ‘request trace log entries’.
Each log entry contains:
“Build REST APIs in three steps with API Management and Azure Functions”
Azure API Management updates – October 2020
The API Management Landscape in 2020
Debug API Management policies in real time
How to create a PowerShell Azure Function using the Azure Portal – 2020 edition