Documentation Index

Fetch the complete documentation index at: https://docs.turbo360.com/llms.txt

Use this file to discover all available pages before exploring further.

API Management

Prev Next

This sample demonstrates how to use Business Activity Monitoring (BAM) data queries to create a business-friendly tracking view for an API Management scenario. In this example, a third-party application submits help desk tickets through an API exposed via Azure API Management (APIM). BAM surfaces the ticket submission requests and their outcomes in a view that support operators can use without needing access to Application Insights.

Walkthrough video

The video below walks through this scenario end to end.

Overview

Business value

This sample shows how BAM data queries can turn raw APIM and Application Insights telemetry into a searchable transaction view. Support operators can search for specific tickets, check request outcomes, and navigate directly to the Application Insights record — all without developer involvement.

How it works

The parent transaction query searches the requests table in Application Insights for calls to a specific APIM operation. It extracts the ticket ID from the request URL and projects the columns needed for the transaction grid. Stage queries then correlate on operation_Id to retrieve request and dependency records for each stage of the transaction.

Parent transaction query

This query retrieves requests for the create-ticket API operation. It uses a replace function to extract the ticket ID from the request URL. You can also use tracked headers or logged message bodies to extract additional business properties.

requests 
| where customDimensions.["API Name"] == "external-api-helpdesk-system-proxy"
| where customDimensions.["Operation Name"] == "create-ticket"
| extend ticket = replace_string(url, "https://kv-eai-apim.azure-api.net/external/helpdesk/tickets/", "")
| project timestamp, ticket, id, success, resultCode, duration, operation_Id

Request stage query

This stage looks up the request log event for the ticket submission and constructs a clickable URL to the Application Insights record in the Azure portal.

let input_item_id = {itemId};
let resourceGroup = "Platform";
let subscriptionId = "08a281b8-3b07-4219-a517-b11230e9b34f";
let appInsightsName = "kv-eai-apim-appinsights";
let portalUrlTemplate = "https://portal.azure.com/#blade/AppInsightsExtension/DetailsV2Blade/DataModel/%7B%22eventId%22:%22[RequestID]%22,%22timestamp%22:%22[startTime]%22%7D/ComponentId/%7B%22Name%22:%22[appInsightsName]%22,%22ResourceGroup%22:%22[resourceGroup]%22,%22SubscriptionId%22:%22[subscription]%22%7D";
let lookups = dynamic([ '[subscription]', '[resourceGroup]', '[appInsightsName]' ]);
let portalUrl = replace_strings(portalUrlTemplate, lookups, pack_array(subscriptionId, resourceGroup, appInsightsName));
requests
| where itemId == input_item_id
| extend azure_portal_url = replace_string(replace_string(portalUrl, "[RequestID]", itemId), "[startTime]", tostring(datetime_add('hour', -1, timestamp)))
| project timestamp, id, name, success, resultCode, duration, customDimensions, customMeasurements, operation_Id, user_AuthenticatedId, operation_ParentId, cloud_RoleInstance, cloud_RoleName, appName, itemId, itemCount, url, azure_portal_url

Backend stage query

This stage looks up the dependency call from APIM to the backend service. It correlates with the parent transaction using operation_Id.

dependencies
| where operation_Id == {operation_Id}