Share via

One APIM in TEST subscription, calls not loggen in Application Insights

Jan Östlund ADM 0 Reputation points
2026-04-01T15:08:11.99+00:00

Hi

Two APIM calls

a) https://apim-xxxxx-weu-test.azure-api.net/InforXA/ItemPrice

b) HTTPS://apim-xxxxx-weu-test.azure-api.net/Unifaun/CreateFile

B is logged in Application Insights, A is not.

Setting per API Diagnostics Logs - Application Insights, looks the same

Whye does not A show up in App-Insights. Logs ?

Note: A -call but in PROD works, also same settings ?

Azure API Management
Azure API Management

An Azure service that provides a hybrid, multi-cloud management platform for APIs.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Siddhesh Desai 4,895 Reputation points Microsoft External Staff Moderator
    2026-04-02T19:23:01.89+00:00

    Hi @Jan Östlund ADM

    Thank you for reaching out to Microsoft Q&A.

    In Azure API Management, requests are logged to Application Insights only after they successfully enter and progress through specific stages of the APIM request pipeline. Even if Application Insights diagnostics are configured identically at the API level, a request may not appear in Application Insights if it is rejected, short‑circuited, or blocked before APIM emits telemetry. In your scenario, API B is logged because the request reaches the frontend/backend pipeline and completes processing, whereas API A is not logged because the request is likely being stopped earlier in the inbound pipeline or never fully processed by APIM in the TEST environment. This can happen due to inbound policies, operation‑level overrides, request validation failures, or environment‑specific differences, even though the same API works as expected in PROD.

    Refer below points to resolve this issue or as a workaround:

    1. Check inbound policies for API A (TEST) Review the <inbound> policies applied at the API and operation level. Policies such as validate-jwt, check-header, rate-limit, ip-filter, or return-response can terminate the request before telemetry is sent to Application Insights. Compare the inbound policies between TEST and PROD carefully, including named values and secrets.

    2. Verify operation-level diagnostics configuration Even if API-level diagnostics look identical, an individual operation under API A may have diagnostics disabled or different verbosity. Operation-level diagnostics override API-level settings, so ensure logging to Application Insights is enabled for the specific operation being called.

    3. Confirm the request actually reaches the APIM pipeline If the request is blocked due to TLS/SNI issues, WAF, Front Door, firewall rules, VNet/NSG configuration, or incorrect host headers, APIM will not process the request and no Application Insights log will be generated. Validate that the request reaches APIM successfully in TEST.

    4. Add a temporary trace policy to validate pipeline execution As a diagnostic step, add the following at the top of the inbound policy for API A:

    <trace severity="information">
     <message>Inbound pipeline reached</message>
    </
    

    Then check Application Insights traces. If this trace does not appear, the request is not reaching the APIM pipeline stage where telemetry is emitted.

    5. Check sampling settings in Application Insights Ensure sampling is set to 100% (or disabled) for APIM telemetry in TEST. Adaptive or fixed sampling may drop some requests, which can make it appear as if certain APIs are not being logged. If the resolution was helpful, kindly take a moment to click on 210246-screenshot-2021-12-10-121802.pngand click on Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

  2. Q&A Assist
    2026-04-01T15:08:36.2766667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    For a single API in Azure API Management to send telemetry to Application Insights, two things must both be correctly configured for that specific API in the TEST APIM instance:

    1. A working Application Insights logger on the APIM instance
    2. A diagnostic on the API that uses that logger

    In this scenario, API B is logged but A is not, which means:

    • The APIM instance can reach Application Insights (logger works), and
    • At least one API-level diagnostic (for B or All APIs) is correctly bound to that logger.

    The most likely causes for API A not appearing in Application Insights in TEST are:

    1. Diagnostics not actually enabled for API A in TEST
      Even if the settings “look the same”, verify on the TEST APIM instance that API A has its own diagnostic created and enabled:
      1. In the TEST APIM instance, go to APIs → APIs.
      2. Select the InforXA/ItemPrice API (or the version used).
      3. Open the Settings tab.
      4. In Diagnostics Logs, confirm:
        • Enable is checked.
        • Destination is set to the same Application Insights logger that API B uses.
        • Sampling (%) is set high enough (for testing, 100%).
        • Always log errors is enabled if error telemetry is expected.
      5. Select Save.
      Behind the scenes this creates/updates a Diagnostic entity named applicationinsights at the API level. If this diagnostic is missing or disabled for API A, no telemetry will be sent for that API, even if API B works.
    2. Different logger selection between A and B
      APIM allows:
      • A logger for All APIs, and
      • A logger for a single API.
      Rules:
      • A single API logger overrides the All APIs logger for that API.
      • If API A has a different logger selected (or none) than API B, it may send telemetry to a different Application Insights resource or not at all.
      Actions:
      • On the TEST APIM instance, compare the Destination logger for API A and API B under APIs → [API] → Settings → Diagnostics Logs.
      • Also check if All APIs has diagnostics enabled and which logger it uses.
      • Ensure API A either:
        • Uses the same logger as B, or
        • Intentionally uses a different logger that points to the Application Insights resource being queried.
    3. Querying the wrong Application Insights resource or wrong sampling expectations
      If API A is configured to use a different logger (for example, pointing to another Application Insights instance), its telemetry will appear there, not in the same resource as B. Also, if sampling for A is lower than B, some calls may not appear. For testing, set Sampling (%) to 100 for API A.
    4. Prod vs Test configuration drift
      The fact that API A logs correctly in PROD but not in TEST indicates configuration differences between the two APIM instances:
      • In PROD, confirm how API A is configured under Diagnostics Logs (per-API vs All APIs, logger name, sampling).
      • Replicate the same configuration in TEST.

    If both APIs in TEST are configured with the same enabled diagnostic, same logger, and sufficient sampling, both should appear in Application Insights. Focus on confirming that API A in TEST has an active diagnostic bound to the correct logger and that the Application Insights resource being queried matches that logger.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.