Skip to content
Get Started for Free

Web Test

Azure Monitor Web Tests (availability tests) send HTTP probes to a URL from multiple geographic locations and alert when the endpoint is unavailable or slow. Web Tests are associated with an Application Insights component and report availability data alongside application telemetry. They are commonly used to monitor public-facing APIs and web applications for uptime and response time from a global perspective. For more information, see Application Insights availability tests.

LocalStack for Azure provides a local environment for building and testing applications that make use of Azure Monitor Web Tests. The supported APIs are available on our API Coverage section, which provides information on the extent of Web Tests’ integration with LocalStack.

This guide walks you through creating a web test linked to an Application Insights component.

Launch LocalStack using your preferred method. For more information, see Introduction to LocalStack for Azure. Once the container is running, enable Azure CLI interception by running:

Terminal window
azlocal start-interception

This command points the az CLI away from the public Azure management REST API and toward the LocalStack for Azure emulator API. To revert this configuration, run:

Terminal window
azlocal stop-interception

This reconfigures the az CLI to send commands to the official Azure management REST API.

Create a resource group to hold all resources created in this guide:

Terminal window
az group create --name rg-webtest-demo --location westeurope
Output
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-webtest-demo",
"location": "westeurope",
"name": "rg-webtest-demo",
"properties": { "provisioningState": "Succeeded" },
"type": "Microsoft.Resources/resourceGroups"
}

Create an Application Insights component to attach the web test to:

Terminal window
az monitor app-insights component create \
--app my-app-insights \
--resource-group rg-webtest-demo \
--location westeurope \
--kind web
Output
{
"appId": "c62300bc-c7ae-5dd1-9f6c-08016bcbfbd9",
"applicationType": "web",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-webtest-demo/providers/microsoft.insights/components/my-app-insights",
"kind": "web",
"location": "westeurope",
"name": "my-app-insights",
"provisioningState": "Succeeded",
"resourceGroup": "rg-webtest-demo",
"type": "microsoft.insights/components",
...
}

Retrieve the Application Insights resource ID, then create a standard availability test linked to it via a hidden-link tag:

Terminal window
AI_ID=$(az monitor app-insights component show \
--app my-app-insights \
--resource-group rg-webtest-demo \
--query id \
--output tsv)
az monitor app-insights web-test create \
--name my-web-test \
--resource-group rg-webtest-demo \
--location westeurope \
--defined-web-test-name "My Web Test" \
--web-test-kind standard \
--enabled true \
--frequency 300 \
--timeout 30 \
--locations Id=us-tx-sn1-azr \
--request-url "https://example.com" \
--http-verb GET \
--tags "hidden-link:$AI_ID=Resource"
Output
{
"enabled": true,
"frequency": 300,
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-webtest-demo/providers/Microsoft.Insights/webtests/my-web-test",
"kind": "ping",
"location": "westeurope",
"locations": [
{
"location": "us-tx-sn1-azr"
}
],
"name": "my-web-test",
"request": {
"httpVerb": "GET",
"requestUrl": "https://example.com"
},
"tags": {
"hidden-link:/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-webtest-demo/providers/microsoft.insights/components/my-app-insights": "Resource"
},
"timeout": 30,
"type": "Microsoft.Insights/webtests",
"webTestKind": "standard",
"webTestName": "My Web Test"
}

Retrieve the details of a specific web test:

Terminal window
az monitor app-insights web-test show \
--name my-web-test \
--resource-group rg-webtest-demo
Output
{
"enabled": true,
"frequency": 300,
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-webtest-demo/providers/Microsoft.Insights/webtests/my-web-test",
"kind": "ping",
"location": "westeurope",
"locations": [
{
"location": "us-tx-sn1-azr"
}
],
"name": "my-web-test",
"request": {
"httpVerb": "GET",
"requestUrl": "https://example.com"
},
"timeout": 30,
"type": "Microsoft.Insights/webtests",
"webTestKind": "standard",
"webTestName": "My Web Test"
}

List all web tests in the resource group:

Terminal window
az monitor app-insights web-test list \
--resource-group rg-webtest-demo
Output
[
{
"enabled": true,
"frequency": 300,
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-webtest-demo/providers/Microsoft.Insights/webtests/my-web-test",
"kind": "ping",
"location": "westeurope",
"locations": [
{
"location": "us-tx-sn1-azr"
}
],
"name": "my-web-test",
"request": {
"httpVerb": "GET",
"requestUrl": "https://example.com"
},
"timeout": 30,
"type": "Microsoft.Insights/webtests",
"webTestKind": "standard",
"webTestName": "My Web Test"
}
]

Delete the web test and verify it no longer appears in the list:

Terminal window
az monitor app-insights web-test delete \
--name my-web-test \
--resource-group rg-webtest-demo \
--yes

Then list all web tests to confirm the resource group is now empty:

Terminal window
az monitor app-insights web-test list --resource-group rg-webtest-demo
Output
[]
  • Web test lifecycle: Create, read, list, and delete web test resources.
  • Classic ping and standard test kinds: Accept ping, multistep, and standard test kinds.
  • Test location configuration: Accept one or more agent location IDs per test.
  • Request configuration: Define URL, HTTP verb, headers, and body for standard tests.
  • Frequency and timeout settings: Configure probing frequency and response timeout.
  • Application Insights linking: Associate web tests with an Application Insights component via the HiddenLink tag.
  • Enable/disable flag: Enable or disable a web test without deleting it.
  • No HTTP probes sent: LocalStack does not send HTTP requests to the configured URL.
  • No availability data collected: Pass, fail, and response time data is not recorded.
  • No availability alerts fired: Alert rules associated with a web test are not triggered.
  • No synthetic transactions: Multi-step and Playwright-based tests are stored but not executed.

Explore end-to-end examples in the LocalStack for Azure Samples repository.

OperationImplemented
Page 1 of 0
Was this page helpful?