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.
- 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.