How to make a custom header saved in standard availability test persist?

Parisa Jourabchi 20 Reputation points
2025-05-07T21:14:09.8033333+00:00

Under applications insights, adding standard availability test. When a custom header is included and saved under standard test info, it then disappears from test (even after saving). It does not persist and the test is not passing the header during the availability test.

This header is successful when using curl from local terminal. Also successful using postman, but it's a problem from the Azure UI and setup of the test.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,590 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vinodh247 33,076 Reputation points MVP Moderator
    2025-05-08T00:52:59.52+00:00

    Hi ,

    Thanks for reaching out to Microsoft Q&A.

    This is a known limitation with Azure Application Insights Standard Availability Tests, custom headers are not persisted or honored reliably, especially through the Azure Portal UI.

    • Standard Availability Tests (also known as URL Ping Tests) are limited in features.

    While the Azure Portal allows adding custom headers in the UI, those headers are often not saved or passed correctly during test execution, especially for authentication or complex scenarios.

    This affects tests that rely on headers like Authorization, x-api-key, or custom routing headers.

    Confirmed Behaviors:

    Custom headers appear to save in the UI but are dropped upon test execution.

    cURL or Postman works because they actually send the headers, unlike the test engine behind the standard test.


    Recommended Solutions:

    Option 1: Use Custom TrackAvailability with Azure Functions or Logic Apps

    Build your own availability test using an Azure Function (or Logic App) and push the results into Application Insights using the TrackAvailability() API.

    You control headers, body, and logic.

    Availability is monitored as custom telemetry.

    Docs: Track availability results manually

    Option 2: Use Classic Multi-step Web Tests (deprecated but usable)

    While deprecated, multi-step web tests in .webtest format (via Visual Studio) support full control, including headers, authentication, and sequence.

    Upload via Azure Portal under classic test.

    Requires an agent (deployed in Azure or on-prem).

    Option 3: Switch to Azure Load Testing or Azure Monitor Synthetic Tests (Preview)

    Azure Load Testing or Azure Monitor Synthetic Tests (preview) offer advanced capabilities with headers, bodies, and scripting.

    These are more modern replacements and offer finer control.

    Can define headers in YAML or script-based tests.


    Workaround (not reliable but sometimes works, try if it clicks fore you):

    If sticking with Standard Tests:

    Edit the test in the classic portal experience or using ARM template/REST API.

    1. Headers may persist better in ARM based definitions than through the GUI. Define test via Bicep/ARM with headers in webTest definition.

    Please feel free to click the 'Upvote' (Thumbs-up) button and 'Accept as Answer'. This helps the community by allowing others with similar queries to easily find the solution.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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