<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Application Insights on Robin Su</title><link>https://robinsujob.github.io/tags/application-insights/</link><description>Recent content in Application Insights on Robin Su</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Wed, 29 Apr 2026 00:00:00 +0800</lastBuildDate><atom:link href="https://robinsujob.github.io/tags/application-insights/index.xml" rel="self" type="application/rss+xml"/><item><title>Building Resilient Azure AI Architecture with API Management Gateway (Part 2) — Retry Observability and Alerting</title><link>https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/</link><pubDate>Wed, 29 Apr 2026 00:00:00 +0800</pubDate><guid>https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/</guid><description>&lt;img src="https://robinsujob.github.io/" alt="Featured image of post Building Resilient Azure AI Architecture with API Management Gateway (Part 2) — Retry Observability and Alerting" /&gt;&lt;p&gt;In the previous article &lt;a class="link" href="../azure-apim-ai-resilience/" &gt;&lt;em&gt;Building Resilient Azure AI Architecture with API Management Gateway&lt;/em&gt;&lt;/a&gt;, we built a resilient gateway architecture for multiple Microsoft Foundry resources using Azure API Management — Backend Load Balancing Pool for load distribution, and a &lt;code&gt;retry&lt;/code&gt; policy that automatically switches to healthy instances when backends return 4xx/5xx errors. This mechanism makes backend failures nearly invisible to clients.&lt;/p&gt;
&lt;p&gt;But &amp;ldquo;invisible&amp;rdquo; is precisely the challenge for operations teams: &lt;strong&gt;The Retry mechanism, while protecting clients, also hides the details of intermediate failures.&lt;/strong&gt; When a request goes through 3 retries and ultimately returns 200, operations staff have no way of knowing why the first two attempts failed — was it a 429 rate limit? A 404 deployment not found? Or a 500 server error? Which backend had the issue? What did the error body say?&lt;/p&gt;
&lt;p&gt;This article builds on the previous architecture to achieve complete Retry observability through &lt;strong&gt;Application Insights Diagnostic Logs&lt;/strong&gt;, &lt;strong&gt;without modifying any Policy code&lt;/strong&gt;, helping developers and operations teams:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;📋 &lt;strong&gt;Record detailed information for each Retry failure&lt;/strong&gt; — including the failed backend address, HTTP status code, error response body, and APIM request ID&lt;/li&gt;
&lt;li&gt;🔍 &lt;strong&gt;Reconstruct complete Retry chains via KQL queries&lt;/strong&gt; — using operation_Id to correlate all retry records for the same request&lt;/li&gt;
&lt;li&gt;🔔 &lt;strong&gt;Configure automated alerts&lt;/strong&gt; — notify the operations team via email when Retry failure counts exceed thresholds&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="1-architecture-overview"&gt;1. Architecture Overview
&lt;/h3&gt;&lt;p&gt;This article adds an Application Insights observability layer on top of the APIM + Foundry resilient architecture from the previous article. No changes to existing APIM Policies or Backend configurations are needed — Retry monitoring and alerting are achieved entirely through Diagnostic Logs configuration.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Components from the previous article (unchanged):&lt;/strong&gt;&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Component&lt;/th&gt;
 &lt;th&gt;Role&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Azure API Management&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Unified gateway, executing routing, Retry, and load balancing policies&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Backend Load Balancing Pool&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Pool of multiple Foundry resources, distributing requests via Round-Robin&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;New components in this article:&lt;/strong&gt;&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Component&lt;/th&gt;
 &lt;th&gt;Role&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Application Insights&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Receives APIM native telemetry (&lt;code&gt;requests&lt;/code&gt; / &lt;code&gt;dependencies&lt;/code&gt;), recording details of each Retry backend call&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Log Alert&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Automatically triggers alert notifications based on KQL queries when failure counts exceed thresholds&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Action Group&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Defines alert actions (Email/SMS/Webhook)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Core design principles:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Zero code changes&lt;/strong&gt; — No Policy modifications needed, fully implemented through APIM Diagnostic Logs configuration&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Native Telemetry&lt;/strong&gt; — APIM&amp;rsquo;s &lt;code&gt;dependencies&lt;/code&gt; table automatically records each &lt;code&gt;forward-request&lt;/code&gt; call (including intermediate Retry failures), combined with Backend Response Headers to log and Body bytes configuration to capture error details and Foundry request IDs&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Full Retry chain visibility&lt;/strong&gt; — All Retry attempts for the same request share the same &lt;code&gt;operation_Id&lt;/code&gt;, making it easy to reconstruct the complete retry chain in KQL&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Proactive alerting&lt;/strong&gt; — Log Alert rules automatically detect failure trends and promptly notify the operations team&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following steps will guide you through building the complete Retry observability solution:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Section&lt;/th&gt;
 &lt;th&gt;Action&lt;/th&gt;
 &lt;th&gt;Goal&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;2&lt;/td&gt;
 &lt;td&gt;Create Application Insights&lt;/td&gt;
 &lt;td&gt;Set up log storage and query infrastructure&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;3&lt;/td&gt;
 &lt;td&gt;Bind APIM Logger&lt;/td&gt;
 &lt;td&gt;Associate APIM with App Insights&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;4&lt;/td&gt;
 &lt;td&gt;Configure API Diagnostic Logs&lt;/td&gt;
 &lt;td&gt;Enable App Insights logging for the target API, configure Verbosity, Backend Response Headers and Body&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;5&lt;/td&gt;
 &lt;td&gt;Verify Data&lt;/td&gt;
 &lt;td&gt;Confirm Retry records in the dependencies table in App Insights&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;6&lt;/td&gt;
 &lt;td&gt;Configure Alert Rules&lt;/td&gt;
 &lt;td&gt;Create Log Alert + Action Group for automated email notifications&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id="2-create-an-application-insights-instance"&gt;2. Create an Application Insights Instance
&lt;/h3&gt;&lt;p&gt;Create a workspace-based Application Insights instance in the same subscription and region as APIM to receive APIM telemetry data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2-1) In the Azure Portal search bar, type Application Insights and select the &lt;strong&gt;Application Insights&lt;/strong&gt; service&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="401px" data-flex-grow="167" height="1408" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/2-1-search-application-insights.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/2-1-search-application-insights_hu_acf1cf99e17b7e8b.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/2-1-search-application-insights_hu_61fc3fb0044de7d7.png 1600w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/2-1-search-application-insights.png 2357w" width="2357"&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2-2) Click &lt;strong&gt;+ Create&lt;/strong&gt;, fill in the following key configurations and complete creation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="232px" data-flex-grow="96" height="1442" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/2-2-create-app-insights.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/2-2-create-app-insights_hu_2128c60a8f4cd365.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/2-2-create-app-insights.png 1396w" width="1396"&gt;&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Configuration&lt;/th&gt;
 &lt;th&gt;Recommended Value&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Subscription&lt;/td&gt;
 &lt;td&gt;Same as APIM&lt;/td&gt;
 &lt;td&gt;Keep in the same subscription for easier management&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Resource group&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;apim-ai-hub&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Same resource group as APIM&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Name&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;ai-hub-app-insight&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Specify an Application Insights instance name&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Region&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;Japan East&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Same region as APIM to reduce data transmission latency&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Workspace&lt;/td&gt;
 &lt;td&gt;Default&lt;/td&gt;
 &lt;td&gt;System automatically creates a Log Analytics workspace, or select one you&amp;rsquo;ve created&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;📝 Note:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Application Insights is workspace-based, with underlying data stored in a Log Analytics workspace. A workspace is automatically associated during creation — no manual creation needed.&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;h3 id="3-bind-apim-logger"&gt;3. Bind APIM Logger
&lt;/h3&gt;&lt;p&gt;Associate the Application Insights instance created in the previous step with APIM, enabling APIM to send telemetry data to App Insights.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3-1) Navigate to the APIM instance → Left menu &lt;strong&gt;Monitoring&lt;/strong&gt; → &lt;strong&gt;Application Insights&lt;/strong&gt; → Click &lt;strong&gt;+ Add&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="440px" data-flex-grow="183" height="1451" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/3-1-bind-apim-logger.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/3-1-bind-apim-logger_hu_cf14459b12773009.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/3-1-bind-apim-logger_hu_8a6c1a171bfb24d4.png 1600w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/3-1-bind-apim-logger_hu_77c3530864ca1fd1.png 2400w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/3-1-bind-apim-logger.png 2665w" width="2665"&gt;&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Configuration&lt;/th&gt;
 &lt;th&gt;Recommended Value&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Application Insights instance&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;ai-hub-app-insight&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Select the Application Insights instance just created&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;☐ Use as default and enable basic logging for all APIs&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Unchecked&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;When checked, this Logger becomes the global default, enabling basic logging for all APIs. Can reduce throughput by 40-50% under high traffic (&amp;gt;1000 req/s). Recommended to enable per-API in Step 4&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;☐ Add availability monitor&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Unchecked&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;When checked, App Insights periodically validates whether the APIM gateway endpoint is responding, with results displayed in App Insights&amp;rsquo; Availability panel. Not needed for this scenario&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id="4-configure-api-diagnostic-logs"&gt;4. Configure API Diagnostic Logs
&lt;/h3&gt;&lt;p&gt;Enable Application Insights logging for the target AI API, configuring sampling rate, error recording, Backend Response, and other parameters.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4-1) Navigate to APIM → APIs → Select target API → Switch to &lt;strong&gt;Settings&lt;/strong&gt; tab → Scroll down to &lt;strong&gt;Diagnostic Logs&lt;/strong&gt; area, click Enable&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="370px" data-flex-grow="154" height="1715" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/4-1-api-settings-diagnostic-logs.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/4-1-api-settings-diagnostic-logs_hu_6a90258f10a6380d.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/4-1-api-settings-diagnostic-logs_hu_79eb34df8dfd1a1c.png 1600w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/4-1-api-settings-diagnostic-logs_hu_7fe7c175d99acd5b.png 2400w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/4-1-api-settings-diagnostic-logs.png 2647w" width="2647"&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4-2) Select the &lt;strong&gt;Application Insights&lt;/strong&gt; tab, check &lt;strong&gt;Enable&lt;/strong&gt;, and configure with the following parameters&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="267px" data-flex-grow="111" height="1212" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/4-2-diagnostic-logs-config.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/4-2-diagnostic-logs-config_hu_872049444957e930.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/4-2-diagnostic-logs-config.png 1350w" width="1350"&gt;&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Configuration&lt;/th&gt;
 &lt;th&gt;Recommended Value&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Destination&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;ai-hub-app-insight&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Select the bound App Insights instance. ⚠️ If it shows &amp;ldquo;No App Insights were configured&amp;rdquo;, go back to Step 3 to bind the Logger first&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Sampling (%)&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;100&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Sampling rate, 100 for full recording (can be adjusted to 25-50 for production)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Always log errors&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;✅ Enable&lt;/td&gt;
 &lt;td&gt;Ensures error requests are not filtered by sampling — all 4xx/5xx are recorded even when Sampling &amp;lt; 100%&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Log client IP address&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;✅ Enable&lt;/td&gt;
 &lt;td&gt;Records caller IP, useful for troubleshooting&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Support custom metrics&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Unchecked&lt;/td&gt;
 &lt;td&gt;Only needed when using the &lt;code&gt;emit-metric&lt;/code&gt; policy, not used in this article&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Verbosity&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;⚠️ &lt;code&gt;Information&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Controls the logging level for native telemetry, &lt;strong&gt;recommended to select Information or Verbose&lt;/strong&gt; (see explanation below)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Correlation protocol&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;W3C&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Modern standard, supports cross-service distributed tracing using &lt;code&gt;traceparent&lt;/code&gt; header to correlate frontend and backend requests&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Verbosity Configuration Notes:&lt;/strong&gt;&lt;/p&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;❗ Important:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Verbosity should be set to &lt;code&gt;Information&lt;/code&gt; or &lt;code&gt;Verbose&lt;/code&gt;, not &lt;code&gt;Error&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Verbosity controls the logging level for the entire request chain&lt;/strong&gt; — successful final requests (200) are treated as information level, failed requests (4xx/5xx) are treated as error level.&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Verbosity&lt;/th&gt;
 &lt;th&gt;Final Request Successful (200)&lt;/th&gt;
 &lt;th&gt;Final Request Failed (4xx/5xx)&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Information&lt;/strong&gt; ✅&lt;/td&gt;
 &lt;td&gt;✅ &lt;code&gt;requests&lt;/code&gt; recorded + ✅ All &lt;code&gt;dependencies&lt;/code&gt; recorded (including intermediate Retry failures)&lt;/td&gt;
 &lt;td&gt;✅ &lt;code&gt;requests&lt;/code&gt; recorded + ✅ All &lt;code&gt;dependencies&lt;/code&gt; recorded&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Error&lt;/strong&gt; ❌&lt;/td&gt;
 &lt;td&gt;❌ &lt;strong&gt;Nothing recorded&lt;/strong&gt; (both request and dependencies are lost)&lt;/td&gt;
 &lt;td&gt;✅ &lt;code&gt;requests&lt;/code&gt; recorded + ✅ Associated &lt;code&gt;dependencies&lt;/code&gt; recorded&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;⚠️ Warning:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;When Verbosity=Error:&lt;/strong&gt; If 2 out of 3 Retry attempts fail (404) but the 3rd attempt succeeds (200), the entire request chain &lt;strong&gt;will not appear in any table&lt;/strong&gt; — including those 2 intermediate failed dependency records. This creates a blind spot for Retry observability.&lt;/p&gt;
&lt;p&gt;Selecting &lt;code&gt;Information&lt;/code&gt; ensures that regardless of whether the final result is success or failure, all Retry processes are fully recorded.&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Additional settings — Backend Response Configuration:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is the key configuration for achieving Retry observability. Check &lt;strong&gt;Backend Response&lt;/strong&gt;, configure Headers to log and Body bytes — APIM will include this information in the &lt;code&gt;Properties&lt;/code&gt; field of the &lt;code&gt;dependencies&lt;/code&gt; table.&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Configuration&lt;/th&gt;
 &lt;th&gt;Recommended Value&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Headers to log&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;apim-request-id&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Records the request tracking ID returned by Foundry, used for locating backend requests when submitting support tickets to Microsoft&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Body bytes to log&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;1024&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Records the first 1KB of response body, capturing error JSON details (e.g., &lt;code&gt;DeploymentNotFound&lt;/code&gt;, &lt;code&gt;Too Many Requests&lt;/code&gt;, etc.)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;📝 Note:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Headers to log and Body bytes apply to &lt;strong&gt;all sampled requests&lt;/strong&gt; (including successful ones), without distinguishing between success and failure. This data appears in two App Insights tables:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;requests&lt;/code&gt; table&lt;/strong&gt; — Records the final request returned to the client (frontend perspective)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;dependencies&lt;/code&gt; table&lt;/strong&gt; — Records each &lt;code&gt;forward-request&lt;/code&gt; call (backend perspective, &lt;strong&gt;including each intermediate Retry attempt&lt;/strong&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;dependencies&lt;/code&gt; table is the core data source for Retry observability.&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;p&gt;Click &lt;strong&gt;Save&lt;/strong&gt; to complete the configuration.&lt;/p&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;⚠️ Warning:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Configuration changes take &lt;strong&gt;several minutes&lt;/strong&gt; to propagate to APIM gateway instances. If you test immediately and see no data, please wait 5 minutes before checking.&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;h3 id="5-verify-data"&gt;5. Verify Data
&lt;/h3&gt;&lt;p&gt;After configuration is complete, send a few test requests that will trigger Retry (e.g., call a non-existent model deployment), wait approximately 5 minutes, then verify data in Application Insights.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5-1) Navigate to Application Insights → Monitoring → ① Logs, ② Switch to Tables view, ③ Find the &lt;code&gt;dependencies&lt;/code&gt; table under the Application Insights category and click Run&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="357px" data-flex-grow="149" height="1691" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/5-1-dependencies-retry-records.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/5-1-dependencies-retry-records_hu_9e2b1c9bfe29f3e2.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/5-1-dependencies-retry-records_hu_2d9636b048ff0ea2.png 1600w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/5-1-dependencies-retry-records_hu_8f8d132eb0a3836c.png 2400w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/5-1-dependencies-retry-records.png 2522w" width="2522"&gt;&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;dependencies&lt;/code&gt; table generates an independent record for &lt;strong&gt;each &lt;code&gt;forward-request&lt;/code&gt; call&lt;/strong&gt; within the &lt;code&gt;retry&lt;/code&gt; block — including intermediate failed Retry attempts and the final successful request. In the results on the right, you can see multiple records pointing to different backends (e.g., &lt;code&gt;ai-hub-swedencentral-02&lt;/code&gt;, &lt;code&gt;ai-hub-eastus2-01&lt;/code&gt;, etc.), all belonging to the same request&amp;rsquo;s Retry chain.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5-2) Expand a single record to view detailed fields and customDimensions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="380px" data-flex-grow="158" height="1779" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/5-2-dependency-custom-dimensions.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/5-2-dependency-custom-dimensions_hu_3ec02de0c7557683.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/5-2-dependency-custom-dimensions_hu_da9d711ed95de465.png 1600w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/5-2-dependency-custom-dimensions_hu_4b398a8a1c40a260.png 2400w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/5-2-dependency-custom-dimensions.png 2824w" width="2824"&gt;&lt;/p&gt;
&lt;p&gt;After expanding, you can see the complete information of the dependency record, with key troubleshooting fields highlighted:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Field&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;&lt;code&gt;target&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Full address of the requested backend&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;&lt;code&gt;resultCode&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;HTTP status code&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Call duration&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;success&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Whether successful&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;&lt;code&gt;Response-Body&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Success/error response JSON details&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;&lt;code&gt;Response-apim-request-id&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Foundry-side request ID (different for each Retry), useful for submitting troubleshooting tickets&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;💡 Tip:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Use &lt;code&gt;operation_Id&lt;/code&gt; to link all Retry records for the same request together, reconstructing the complete retry chain. &lt;code&gt;Response-apim-request-id&lt;/code&gt; can be used to locate specific backend requests when submitting support tickets to Microsoft.&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;h3 id="6-configure-alert-rules"&gt;6. Configure Alert Rules
&lt;/h3&gt;&lt;p&gt;Automatically notify the operations team via email when Retry failure counts exceed thresholds. Alert rules are created on &lt;strong&gt;Application Insights&lt;/strong&gt; (not APIM).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6-1) Write and verify KQL query on the Logs page&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Navigate to Application Insights → Monitoring → &lt;strong&gt;Logs&lt;/strong&gt;, ① create a new query tab, ② switch to &lt;strong&gt;KQL mode&lt;/strong&gt;, ③ enter the following query and ④ click &lt;strong&gt;Run&lt;/strong&gt; to verify results:&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="375px" data-flex-grow="156" height="1172" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-1-kql-query-in-logs.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-1-kql-query-in-logs_hu_642be3aedad56c4.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-1-kql-query-in-logs_hu_cc2065b85fea4e56.png 1600w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-1-kql-query-in-logs.png 1836w" width="1836"&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;span class="lnt"&gt;4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dependencies
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| where success == false
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| where resultCode in (&amp;#34;429&amp;#34;, &amp;#34;500&amp;#34;, &amp;#34;502&amp;#34;, &amp;#34;503&amp;#34;, &amp;#34;504&amp;#34;) or toint(resultCode) &amp;gt;= 400
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| summarize FailureCount = count()
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Adjust the status code filter as needed:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Scenario&lt;/th&gt;
 &lt;th&gt;Filter Condition&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;All failures&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;where success == false&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Rate limiting only (429)&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;where resultCode == &amp;quot;429&amp;quot;&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;5xx server errors only&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;where toint(resultCode) &amp;gt;= 500&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;429 + 5xx&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;where resultCode == &amp;quot;429&amp;quot; or toint(resultCode) &amp;gt;= 500&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Exclude 404&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;where success == false and resultCode != &amp;quot;404&amp;quot;&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Confirm the query returns the expected FailureCount value.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6-2) Click the &lt;strong&gt;&lt;code&gt;...&lt;/code&gt;&lt;/strong&gt; menu in the top right → &lt;strong&gt;+ New alert rule&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="342px" data-flex-grow="142" height="647" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-2-new-alert-rule.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-2-new-alert-rule_hu_cc3b6550b8d4b269.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-2-new-alert-rule.png 922w" width="922"&gt;&lt;/p&gt;
&lt;p&gt;The system will automatically carry over the current KQL query into the Alert rule&amp;rsquo;s Condition configuration.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6-3) Confirm query and Measurement configuration on the Condition tab&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="267px" data-flex-grow="111" height="1473" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-3-alert-condition-measurement.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-3-alert-condition-measurement_hu_581e6c3507c648d5.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-3-alert-condition-measurement_hu_918929b7c5602c7b.png 1600w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-3-alert-condition-measurement.png 1642w" width="1642"&gt;&lt;/p&gt;
&lt;p&gt;Three key configurations highlighted in the screenshot:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Annotation&lt;/th&gt;
 &lt;th&gt;Configuration&lt;/th&gt;
 &lt;th&gt;Value&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;①&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Search query&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;KQL from previous step (auto-populated)&lt;/td&gt;
 &lt;td&gt;Contains &lt;code&gt;success == false&lt;/code&gt; + status code filter + &lt;code&gt;summarize FailureCount = count()&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;②&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Measure&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;FailureCount&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;⚠️ Must select &lt;code&gt;FailureCount&lt;/code&gt; (auto-detected from KQL&amp;rsquo;s summarize). If it defaults to &lt;code&gt;Table rows&lt;/code&gt;, switch manually&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;③&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Aggregation granularity&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;3 hours&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Aggregation granularity — aggregates FailureCount within this time range into a single data point for evaluation&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Other settings keep defaults:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Query type&lt;/strong&gt;: Aggregated logs&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Aggregation type&lt;/strong&gt;: Total (sum of FailureCount)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;6-4) Scroll down to configure Alert logic&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="358px" data-flex-grow="149" height="1113" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-4-alert-logic-threshold.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-4-alert-logic-threshold_hu_e8c567663cf0217.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-4-alert-logic-threshold_hu_10bae5d7c67dab9d.png 1600w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-4-alert-logic-threshold.png 1661w" width="1661"&gt;&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Configuration&lt;/th&gt;
 &lt;th&gt;Value&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Threshold type&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Static&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Use fixed threshold&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Operator&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Greater than&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Trigger when FailureCount exceeds threshold&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Threshold value&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;10&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Adjust based on business tolerance&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Frequency of evaluation&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;15 minutes&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Evaluate every 15 minutes&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;📝 Note:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;📊 The &lt;strong&gt;Preview&lt;/strong&gt; chart below displays the FailureCount trend and threshold line (dashed), helping you assess whether the threshold setting is reasonable. Areas where the blue solid line exceeds the dashed threshold line indicate periods that would trigger alerts.&lt;/p&gt;
&lt;p&gt;💰 Estimated monthly cost is approximately &lt;strong&gt;$0.50 USD&lt;/strong&gt; (depends on evaluation frequency).&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;p&gt;Click &lt;strong&gt;Next: Actions &amp;gt;&lt;/strong&gt; to proceed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6-5) Configure alert actions on the Actions tab&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If the Portal displays the &lt;strong&gt;Use quick actions (preview)&lt;/strong&gt; option (new UI), you can complete Action Group creation directly on this page without creating one separately:&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="387px" data-flex-grow="161" height="1521" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-5-quick-actions-preview.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-5-quick-actions-preview_hu_e24a82964c1c43b7.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-5-quick-actions-preview_hu_32781c44552b9774.png 1600w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-5-quick-actions-preview_hu_ef08194da7af03db.png 2400w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-5-quick-actions-preview.png 2453w" width="2453"&gt;&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Annotation&lt;/th&gt;
 &lt;th&gt;Configuration&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;①&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Use quick actions (preview)&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Select this option, and the Portal will automatically create an Action Group&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;②&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Quick actions panel&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Fill in Action group name, Display name, check Email and enter email address → &lt;strong&gt;Save&lt;/strong&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;③&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Email subject&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Custom alert email subject, e.g., &lt;code&gt;AI Hub Retry Alert&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;📝 Note:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If the Portal doesn&amp;rsquo;t show the quick actions option (legacy UI), select &lt;strong&gt;Use action groups&lt;/strong&gt; → &lt;strong&gt;+ Create action group&lt;/strong&gt;, and follow steps 6-6 ~ 6-8 below to create one manually.&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;6-6) Fill in Action Group basic information&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="449px" data-flex-grow="187" height="843" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-6-action-group-basics.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-6-action-group-basics_hu_7bf86028e786560d.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-6-action-group-basics.png 1578w" width="1578"&gt;&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Configuration&lt;/th&gt;
 &lt;th&gt;Value&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Region&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Global&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Recommended to select Global for Action Groups&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Action group name&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;ai-hub-retry-alert-action&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Unique identifier&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Display name&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;AI-Hub-Retry&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Limited to 12 characters, displayed in notifications&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;6-7) Switch to the Notifications tab and configure email notifications&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="519px" data-flex-grow="216" height="1056" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-7-action-group-notifications.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-7-action-group-notifications_hu_f73f8c20a5afca11.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-7-action-group-notifications_hu_7e3cabadfe52490a.png 1600w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-7-action-group-notifications.png 2286w" width="2286"&gt;&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Configuration&lt;/th&gt;
 &lt;th&gt;Value&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Notification type&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Email/SMS message/Push/Voice&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Select notification method&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Name&lt;/td&gt;
 &lt;td&gt;Recipient name&lt;/td&gt;
 &lt;td&gt;Notification recipient identifier&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Email&lt;/td&gt;
 &lt;td&gt;✅ Check and enter email&lt;/td&gt;
 &lt;td&gt;Alert email recipient address&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;📝 Note:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The Actions tab allows configuration of richer automated actions (Automation Runbook, Azure Function, Logic App, Webhook, etc.). These are not used in this article — simply skip.&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="421px" data-flex-grow="175" height="816" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-8-action-group-actions.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-8-action-group-actions_hu_c23fee3f12422516.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-8-action-group-actions.png 1434w" width="1434"&gt;&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;6-8) Switch to the Review + create tab, confirm configuration and click &lt;strong&gt;Create&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="282px" data-flex-grow="117" height="1348" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-8-action-group-review-create.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-8-action-group-review-create_hu_ed0653e8c8c38395.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-8-action-group-review-create.png 1584w" width="1584"&gt;&lt;/p&gt;
&lt;p&gt;After creation, you&amp;rsquo;ll receive an Azure confirmation email indicating you&amp;rsquo;ve been added to the Action Group:&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="333px" data-flex-grow="138" height="849" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-8-action-group-email-confirm.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-8-action-group-email-confirm_hu_113108bed65e44e4.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-8-action-group-email-confirm.png 1180w" width="1180"&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6-9) Return to the Alert rule&amp;rsquo;s Actions page, confirm the Action Group is associated, and fill in the email subject&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="279px" data-flex-grow="116" height="1351" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-9-alert-actions-email-subject.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-9-alert-actions-email-subject_hu_4deac364262f2076.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-9-alert-actions-email-subject.png 1576w" width="1576"&gt;&lt;/p&gt;
&lt;p&gt;Enter a custom alert email subject in the &lt;strong&gt;Email subject&lt;/strong&gt; field, e.g., &lt;code&gt;AI Hub Retry Alert&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6-10) Switch to the Details tab and fill in Alert rule basic information&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="282px" data-flex-grow="117" height="1355" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-10-alert-details.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-10-alert-details_hu_dbcef4146041b689.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-10-alert-details.png 1595w" width="1595"&gt;&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Configuration&lt;/th&gt;
 &lt;th&gt;Value&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Severity&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;2 - Warning&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Alert severity level&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Alert rule name&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;AI-Hub-Alert&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Alert rule name&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Region&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;Japan East&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Same region as App Insights&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Identity&lt;/td&gt;
 &lt;td&gt;&lt;strong&gt;Default&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Use default identity&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;6-11) Switch to Review + create to confirm all configurations, click &lt;strong&gt;Create&lt;/strong&gt; to complete&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="218px" data-flex-grow="91" height="1342" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-11-alert-review-create.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-11-alert-review-create_hu_a50e8bf7c746406e.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-11-alert-review-create.png 1222w" width="1222"&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6-12) Verify alert email&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Approximately 15 minutes after creation, when FailureCount exceeds the threshold (10), you&amp;rsquo;ll receive an alert email:&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="326px" data-flex-grow="136" height="1123" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-12-alert-email-notification.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-12-alert-email-notification_hu_633484e3ccfa6737.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-12-alert-email-notification.png 1529w" width="1529"&gt;&lt;/p&gt;
&lt;p&gt;The email contains key information:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Field&lt;/th&gt;
 &lt;th&gt;Value&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Alert name&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;AI-Hub-Alert&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Name of the triggered alert rule&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Severity&lt;/td&gt;
 &lt;td&gt;Warning&lt;/td&gt;
 &lt;td&gt;Alert level&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Metric value&lt;/td&gt;
 &lt;td&gt;15&lt;/td&gt;
 &lt;td&gt;Actual FailureCount&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Threshold&lt;/td&gt;
 &lt;td&gt;10&lt;/td&gt;
 &lt;td&gt;Configured threshold&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Fired time&lt;/td&gt;
 &lt;td&gt;Specific time (UTC)&lt;/td&gt;
 &lt;td&gt;When the alert was triggered&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Click &lt;strong&gt;View alert details&lt;/strong&gt; in the email to jump directly to Azure Portal for details; &lt;strong&gt;View search results&lt;/strong&gt; to view the KQL query results that triggered the alert.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;6-13) (Optional) Fine-tune alert parameters&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;After the alert rule is created, navigate to Application Insights → Monitoring → &lt;strong&gt;Alerts&lt;/strong&gt; → &lt;strong&gt;Alert rules&lt;/strong&gt; → Select the corresponding rule → Click the &lt;strong&gt;Edit&lt;/strong&gt; button:&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="712px" data-flex-grow="297" height="606" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-13-alert-edit-button.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-13-alert-edit-button_hu_caf882434c1c375a.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-13-alert-edit-button_hu_3f71a1ceb886ff91.png 1600w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-13-alert-edit-button.png 1800w" width="1800"&gt;&lt;/p&gt;
&lt;p&gt;In the editing page&amp;rsquo;s &lt;strong&gt;Details tab → Advanced options&lt;/strong&gt;, fine-tune further:&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="452px" data-flex-grow="188" height="791" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-13-alert-advanced-mute.png" srcset="https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-13-alert-advanced-mute_hu_42206efbc0e4a856.png 800w, https://robinsujob.github.io/p/azure-apim-ai-resilience-part2/images/6-13-alert-advanced-mute.png 1491w" width="1491"&gt;&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Configuration&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;th&gt;Recommended Value&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Mute actions&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Enter a silent period after triggering, during which no repeat notifications are sent&lt;/td&gt;
 &lt;td&gt;✅ Check&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Mute actions for&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Silent duration — no notifications during this period even if conditions persist&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;3 hours&lt;/code&gt; (adjust as needed)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Automatically resolve alerts&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Automatically change alert status from Fired to Resolved when conditions are no longer met&lt;/td&gt;
 &lt;td&gt;Check as needed&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;

 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;💡 Tip:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If the evaluation frequency is 15 minutes and Mute is not configured, &lt;strong&gt;an email notification will be sent every 15 minutes&lt;/strong&gt; while alert conditions persist. Configuring Mute prevents repeated notifications after the first alert trigger, avoiding email flooding.&lt;/p&gt;
&lt;p&gt;Additionally, you can adjust &lt;strong&gt;Aggregation granularity&lt;/strong&gt;, &lt;strong&gt;Threshold value&lt;/strong&gt;, &lt;strong&gt;Frequency of evaluation&lt;/strong&gt;, and other parameters on the editing page to optimize alert sensitivity.&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;h3 id="7-appendix-advanced-kql-queries-and-client-ip-configuration-optional"&gt;7. Appendix: Advanced KQL Queries and Client IP Configuration (Optional)
&lt;/h3&gt;&lt;h4 id="7-1-enable-real-client-ip-recording"&gt;7-1) Enable Real Client IP Recording
&lt;/h4&gt;&lt;p&gt;Application Insights &lt;strong&gt;does not store client IP addresses by default&lt;/strong&gt; (privacy protection), and the &lt;code&gt;client_IP&lt;/code&gt; field displays as &lt;code&gt;0.0.0.0&lt;/code&gt;. Disable IP masking via CLI to record real IPs:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;span class="lnt"&gt;4
&lt;/span&gt;&lt;span class="lnt"&gt;5
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;az resource update &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --resource-group &amp;lt;resource-group&amp;gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --name &amp;lt;app-insights-name&amp;gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --resource-type &lt;span class="s2"&gt;&amp;#34;Microsoft.Insights/components&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --set properties.DisableIpMasking&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;⚠️ Warning:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Disabling IP masking will record real client IP addresses. Please ensure this complies with your organization&amp;rsquo;s privacy requirements.&lt;/p&gt;
&lt;p&gt;📖 Reference: Geolocation and IP address handling: &lt;a class="link" href="https://learn.microsoft.com/azure/azure-monitor/app/ip-collection" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/azure/azure-monitor/app/ip-collection&lt;/a&gt;&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;h4 id="7-2-correlate-client-ip-with-retry-failure-records"&gt;7-2) Correlate Client IP with Retry Failure Records
&lt;/h4&gt;&lt;p&gt;The &lt;code&gt;dependencies&lt;/code&gt; table itself does not contain client IP (it records APIM → backend outbound calls). You need to JOIN with the &lt;code&gt;requests&lt;/code&gt; table via &lt;code&gt;operation_Id&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1
&lt;/span&gt;&lt;span class="lnt"&gt; 2
&lt;/span&gt;&lt;span class="lnt"&gt; 3
&lt;/span&gt;&lt;span class="lnt"&gt; 4
&lt;/span&gt;&lt;span class="lnt"&gt; 5
&lt;/span&gt;&lt;span class="lnt"&gt; 6
&lt;/span&gt;&lt;span class="lnt"&gt; 7
&lt;/span&gt;&lt;span class="lnt"&gt; 8
&lt;/span&gt;&lt;span class="lnt"&gt; 9
&lt;/span&gt;&lt;span class="lnt"&gt;10
&lt;/span&gt;&lt;span class="lnt"&gt;11
&lt;/span&gt;&lt;span class="lnt"&gt;12
&lt;/span&gt;&lt;span class="lnt"&gt;13
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dependencies
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| where timestamp &amp;gt; ago(1h)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| where success == false
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| join kind=leftouter (
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; requests 
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; | project operation_Id, req_client_IP = client_IP
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ) on operation_Id
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| project timestamp, target, resultCode, 
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ClientIP = req_client_IP,
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ErrorBody = tostring(customDimensions[&amp;#34;Response-Body&amp;#34;]),
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; APIMRequestId = tostring(customDimensions[&amp;#34;Response-apim-request-id&amp;#34;]),
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; operation_Id
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| order by timestamp desc
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
 &lt;blockquote&gt;
 &lt;p&gt;&lt;strong&gt;📝 Note:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Both &lt;code&gt;requests&lt;/code&gt; and &lt;code&gt;dependencies&lt;/code&gt; tables have a &lt;code&gt;client_IP&lt;/code&gt; field, but with different meanings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;requests.client_IP&lt;/code&gt;&lt;/strong&gt; — IP of the client calling APIM (real client)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;dependencies.client_IP&lt;/code&gt;&lt;/strong&gt; — APIM gateway&amp;rsquo;s outbound IP (not the client)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When JOINing, use renaming (e.g., &lt;code&gt;req_client_IP&lt;/code&gt;) to avoid field conflicts.&lt;/p&gt;

 &lt;/blockquote&gt;
&lt;h4 id="7-3-more-useful-kql-queries"&gt;7-3) More Useful KQL Queries
&lt;/h4&gt;&lt;p&gt;&lt;strong&gt;Reconstruct complete Retry chain by operation_Id (including the successful attempt):&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;span class="lnt"&gt;4
&lt;/span&gt;&lt;span class="lnt"&gt;5
&lt;/span&gt;&lt;span class="lnt"&gt;6
&lt;/span&gt;&lt;span class="lnt"&gt;7
&lt;/span&gt;&lt;span class="lnt"&gt;8
&lt;/span&gt;&lt;span class="lnt"&gt;9
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dependencies
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| where timestamp &amp;gt; ago(1h)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| summarize CallCount = count(),
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Backends = make_list(target),
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; StatusCodes = make_list(resultCode),
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Durations = make_list(duration)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; by operation_Id
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| where CallCount &amp;gt; 1
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| order by CallCount desc
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Failure trend chart:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;span class="lnt"&gt;4
&lt;/span&gt;&lt;span class="lnt"&gt;5
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dependencies
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| where timestamp &amp;gt; ago(24h)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| where success == false
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| summarize FailureCount = count() by bin(timestamp, 5m), target
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| render timechart
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;strong&gt;For alerting (grouped by backend + status code):&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;span class="lnt"&gt;4
&lt;/span&gt;&lt;span class="lnt"&gt;5
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dependencies
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| where timestamp &amp;gt; ago(2h)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| where success == false
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| summarize FailureCount = count() by target, resultCode
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;| where FailureCount &amp;gt; 0
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h3 id="summary"&gt;Summary
&lt;/h3&gt;&lt;p&gt;Through this article&amp;rsquo;s implementation, we&amp;rsquo;ve built a complete Retry observability solution on top of the resilient gateway architecture from the previous article:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Capability&lt;/th&gt;
 &lt;th&gt;Implementation&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Each Retry failure recorded&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;APIM native &lt;code&gt;dependencies&lt;/code&gt; table automatically records each &lt;code&gt;forward-request&lt;/code&gt; call&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Error Body recording&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Backend Response Body bytes=1024, error JSON details appear in Properties&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Request tracking IDs&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;operation_Id&lt;/code&gt; (unchanged across Retries) + &lt;code&gt;Response-apim-request-id&lt;/code&gt; (Foundry-side ID)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Call duration&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Native &lt;code&gt;DurationMs&lt;/code&gt; field, precise to milliseconds&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;KQL queries&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Support aggregation analysis by backend, status code, and time dimensions&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;strong&gt;Automated alerting&lt;/strong&gt;&lt;/td&gt;
 &lt;td&gt;Log Alert rules + Action Group email notifications&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;For users who have already deployed the resilient architecture from the previous article, this article &lt;strong&gt;requires no Policy code changes&lt;/strong&gt; — complete Retry observability is achieved solely through APIM Diagnostic Logs configuration (binding App Insights + &lt;strong&gt;setting Verbosity to Information&lt;/strong&gt; + enabling Backend Response Headers/Body).&lt;/p&gt;
&lt;p&gt;Those errors hidden by the Retry mechanism are now clearly recorded in Application Insights&amp;rsquo; &lt;code&gt;dependencies&lt;/code&gt; table, ready for operations staff to review and address.&lt;/p&gt;
&lt;h3 id="references"&gt;References
&lt;/h3&gt;&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Document&lt;/th&gt;
 &lt;th&gt;Link&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;How to integrate Azure API Management with Azure Application Insights&lt;/td&gt;
 &lt;td&gt;&lt;a class="link" href="https://learn.microsoft.com/azure/api-management/api-management-howto-app-insights" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/azure/api-management/api-management-howto-app-insights&lt;/a&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Diagnostic - Create Or Update REST API&lt;/td&gt;
 &lt;td&gt;&lt;a class="link" href="https://learn.microsoft.com/rest/api/apimanagement/diagnostic/create-or-update" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/rest/api/apimanagement/diagnostic/create-or-update&lt;/a&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Application Insights telemetry data model&lt;/td&gt;
 &lt;td&gt;&lt;a class="link" href="https://learn.microsoft.com/azure/azure-monitor/app/data-model-complete" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/azure/azure-monitor/app/data-model-complete&lt;/a&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Geolocation and IP address handling (IP masking)&lt;/td&gt;
 &lt;td&gt;&lt;a class="link" href="https://learn.microsoft.com/azure/azure-monitor/app/ip-collection" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/azure/azure-monitor/app/ip-collection&lt;/a&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Subscriptions in Azure API Management&lt;/td&gt;
 &lt;td&gt;&lt;a class="link" href="https://learn.microsoft.com/azure/api-management/api-management-subscriptions" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/azure/api-management/api-management-subscriptions&lt;/a&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Tutorial: Create a log search alert for an Azure resource&lt;/td&gt;
 &lt;td&gt;&lt;a class="link" href="https://learn.microsoft.com/azure/azure-monitor/alerts/tutorial-log-alert" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/azure/azure-monitor/alerts/tutorial-log-alert&lt;/a&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Create and manage action groups&lt;/td&gt;
 &lt;td&gt;&lt;a class="link" href="https://learn.microsoft.com/azure/azure-monitor/alerts/action-groups" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/azure/azure-monitor/alerts/action-groups&lt;/a&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Kusto Query Language (KQL) overview&lt;/td&gt;
 &lt;td&gt;&lt;a class="link" href="https://learn.microsoft.com/azure/data-explorer/kusto/query/" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/azure/data-explorer/kusto/query/&lt;/a&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Performance implications and log sampling&lt;/td&gt;
 &lt;td&gt;&lt;a class="link" href="https://learn.microsoft.com/azure/api-management/api-management-howto-app-insights#performance-implications-and-log-sampling" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/azure/api-management/api-management-howto-app-insights#performance-implications-and-log-sampling&lt;/a&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Azure Monitor pricing&lt;/td&gt;
 &lt;td&gt;&lt;a class="link" href="https://azure.microsoft.com/pricing/details/monitor/" target="_blank" rel="noopener"
 &gt;https://azure.microsoft.com/pricing/details/monitor/&lt;/a&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;</description></item></channel></rss>