Configure Azure Application Insights Web Tests

The azure-native:applicationinsights:WebTest resource, part of the Pulumi Azure Native provider, defines synthetic monitoring tests that verify endpoint availability and behavior from distributed Azure locations. This guide focuses on three capabilities: ping tests for basic availability monitoring, standard tests with custom HTTP requests, and geographic distribution configuration.

WebTests belong to Application Insights components and execute from Azure’s global test locations. The examples are intentionally small. Combine them with your own Application Insights components and alert rules.

Monitor endpoint availability with ping tests

Most availability monitoring starts with simple ping tests that verify endpoints respond correctly from multiple geographic locations.

import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const webTest = new azure_native.applicationinsights.WebTest("webTest", {
    configuration: {
        webTest: "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"120\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"120\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>",
    },
    description: "Ping web test alert for mytestwebapp",
    enabled: true,
    frequency: 900,
    kind: azure_native.applicationinsights.WebTestKind.Ping,
    location: "South Central US",
    locations: [{
        location: "us-fl-mia-edge",
    }],
    resourceGroupName: "my-resource-group",
    retryEnabled: true,
    syntheticMonitorId: "my-webtest-my-component",
    timeout: 120,
    webTestKind: azure_native.applicationinsights.WebTestKind.Ping,
    webTestName: "my-webtest-my-component",
});
import pulumi
import pulumi_azure_native as azure_native

web_test = azure_native.applicationinsights.WebTest("webTest",
    configuration={
        "web_test": "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"120\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"120\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>",
    },
    description="Ping web test alert for mytestwebapp",
    enabled=True,
    frequency=900,
    kind=azure_native.applicationinsights.WebTestKind.PING,
    location="South Central US",
    locations=[{
        "location": "us-fl-mia-edge",
    }],
    resource_group_name="my-resource-group",
    retry_enabled=True,
    synthetic_monitor_id="my-webtest-my-component",
    timeout=120,
    web_test_kind=azure_native.applicationinsights.WebTestKind.PING,
    web_test_name="my-webtest-my-component")
package main

import (
	applicationinsights "github.com/pulumi/pulumi-azure-native-sdk/applicationinsights/v3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := applicationinsights.NewWebTest(ctx, "webTest", &applicationinsights.WebTestArgs{
			Configuration: &applicationinsights.WebTestPropertiesConfigurationArgs{
				WebTest: pulumi.String("<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"120\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"120\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>"),
			},
			Description: pulumi.String("Ping web test alert for mytestwebapp"),
			Enabled:     pulumi.Bool(true),
			Frequency:   pulumi.Int(900),
			Kind:        applicationinsights.WebTestKindPing,
			Location:    pulumi.String("South Central US"),
			Locations: applicationinsights.WebTestGeolocationArray{
				&applicationinsights.WebTestGeolocationArgs{
					Location: pulumi.String("us-fl-mia-edge"),
				},
			},
			ResourceGroupName:  pulumi.String("my-resource-group"),
			RetryEnabled:       pulumi.Bool(true),
			SyntheticMonitorId: pulumi.String("my-webtest-my-component"),
			Timeout:            pulumi.Int(120),
			WebTestKind:        applicationinsights.WebTestKindPing,
			WebTestName:        pulumi.String("my-webtest-my-component"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var webTest = new AzureNative.ApplicationInsights.WebTest("webTest", new()
    {
        Configuration = new AzureNative.ApplicationInsights.Inputs.WebTestPropertiesConfigurationArgs
        {
            WebTest = "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"120\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"120\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>",
        },
        Description = "Ping web test alert for mytestwebapp",
        Enabled = true,
        Frequency = 900,
        Kind = AzureNative.ApplicationInsights.WebTestKind.Ping,
        Location = "South Central US",
        Locations = new[]
        {
            new AzureNative.ApplicationInsights.Inputs.WebTestGeolocationArgs
            {
                Location = "us-fl-mia-edge",
            },
        },
        ResourceGroupName = "my-resource-group",
        RetryEnabled = true,
        SyntheticMonitorId = "my-webtest-my-component",
        Timeout = 120,
        WebTestKind = AzureNative.ApplicationInsights.WebTestKind.Ping,
        WebTestName = "my-webtest-my-component",
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.applicationinsights.WebTest;
import com.pulumi.azurenative.applicationinsights.WebTestArgs;
import com.pulumi.azurenative.applicationinsights.inputs.WebTestPropertiesConfigurationArgs;
import com.pulumi.azurenative.applicationinsights.inputs.WebTestGeolocationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var webTest = new WebTest("webTest", WebTestArgs.builder()
            .configuration(WebTestPropertiesConfigurationArgs.builder()
                .webTest("<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"120\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"120\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>")
                .build())
            .description("Ping web test alert for mytestwebapp")
            .enabled(true)
            .frequency(900)
            .kind("ping")
            .location("South Central US")
            .locations(WebTestGeolocationArgs.builder()
                .location("us-fl-mia-edge")
                .build())
            .resourceGroupName("my-resource-group")
            .retryEnabled(true)
            .syntheticMonitorId("my-webtest-my-component")
            .timeout(120)
            .webTestKind("ping")
            .webTestName("my-webtest-my-component")
            .build());

    }
}
resources:
  webTest:
    type: azure-native:applicationinsights:WebTest
    properties:
      configuration:
        webTest: <WebTest Name="my-webtest" Id="678ddf96-1ab8-44c8-9274-123456789abc" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="120" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="default" StopOnError="False" RecordedResultFile="" ResultsLocale="" ><Items><Request Method="GET" Guid="a4162485-9114-fcfc-e086-123456789abc" Version="1.1" Url="http://my-component.azurewebsites.net" ThinkTime="0" Timeout="120" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="200" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" /></Items></WebTest>
      description: Ping web test alert for mytestwebapp
      enabled: true
      frequency: 900
      kind: ping
      location: South Central US
      locations:
        - location: us-fl-mia-edge
      resourceGroupName: my-resource-group
      retryEnabled: true
      syntheticMonitorId: my-webtest-my-component
      timeout: 120
      webTestKind: ping
      webTestName: my-webtest-my-component

The webTestKind property set to “ping” creates a basic availability test. The configuration property contains Visual Studio WebTest XML that defines the HTTP request, including the target URL and expected status code. The locations array specifies where Azure runs the test from; here, tests execute from Miami every 900 seconds (15 minutes). The syntheticMonitorId links this test to an Application Insights component.

Send custom HTTP requests with headers and validation

Applications that require specific request formats or need to validate SSL certificates use standard tests to control HTTP methods, headers, and response validation.

import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const webTest = new azure_native.applicationinsights.WebTest("webTest", {
    description: "Ping web test alert for mytestwebapp",
    enabled: true,
    frequency: 900,
    location: "South Central US",
    locations: [{
        location: "us-fl-mia-edge",
    }],
    request: {
        headers: [
            {
                headerFieldName: "Content-Language",
                headerFieldValue: "de-DE",
            },
            {
                headerFieldName: "Accept-Language",
                headerFieldValue: "de-DE",
            },
        ],
        httpVerb: "POST",
        requestBody: "SGVsbG8gd29ybGQ=",
        requestUrl: "https://bing.com",
    },
    resourceGroupName: "my-resource-group",
    retryEnabled: true,
    syntheticMonitorId: "my-webtest-my-component",
    timeout: 120,
    validationRules: {
        sSLCertRemainingLifetimeCheck: 100,
        sSLCheck: true,
    },
    webTestKind: azure_native.applicationinsights.WebTestKind.Standard,
    webTestName: "my-webtest-my-component",
});
import pulumi
import pulumi_azure_native as azure_native

web_test = azure_native.applicationinsights.WebTest("webTest",
    description="Ping web test alert for mytestwebapp",
    enabled=True,
    frequency=900,
    location="South Central US",
    locations=[{
        "location": "us-fl-mia-edge",
    }],
    request={
        "headers": [
            {
                "header_field_name": "Content-Language",
                "header_field_value": "de-DE",
            },
            {
                "header_field_name": "Accept-Language",
                "header_field_value": "de-DE",
            },
        ],
        "http_verb": "POST",
        "request_body": "SGVsbG8gd29ybGQ=",
        "request_url": "https://bing.com",
    },
    resource_group_name="my-resource-group",
    retry_enabled=True,
    synthetic_monitor_id="my-webtest-my-component",
    timeout=120,
    validation_rules={
        "s_sl_cert_remaining_lifetime_check": 100,
        "s_sl_check": True,
    },
    web_test_kind=azure_native.applicationinsights.WebTestKind.STANDARD,
    web_test_name="my-webtest-my-component")
package main

import (
	applicationinsights "github.com/pulumi/pulumi-azure-native-sdk/applicationinsights/v3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := applicationinsights.NewWebTest(ctx, "webTest", &applicationinsights.WebTestArgs{
			Description: pulumi.String("Ping web test alert for mytestwebapp"),
			Enabled:     pulumi.Bool(true),
			Frequency:   pulumi.Int(900),
			Location:    pulumi.String("South Central US"),
			Locations: applicationinsights.WebTestGeolocationArray{
				&applicationinsights.WebTestGeolocationArgs{
					Location: pulumi.String("us-fl-mia-edge"),
				},
			},
			Request: &applicationinsights.WebTestPropertiesRequestArgs{
				Headers: applicationinsights.HeaderFieldArray{
					&applicationinsights.HeaderFieldArgs{
						HeaderFieldName:  pulumi.String("Content-Language"),
						HeaderFieldValue: pulumi.String("de-DE"),
					},
					&applicationinsights.HeaderFieldArgs{
						HeaderFieldName:  pulumi.String("Accept-Language"),
						HeaderFieldValue: pulumi.String("de-DE"),
					},
				},
				HttpVerb:    pulumi.String("POST"),
				RequestBody: pulumi.String("SGVsbG8gd29ybGQ="),
				RequestUrl:  pulumi.String("https://bing.com"),
			},
			ResourceGroupName:  pulumi.String("my-resource-group"),
			RetryEnabled:       pulumi.Bool(true),
			SyntheticMonitorId: pulumi.String("my-webtest-my-component"),
			Timeout:            pulumi.Int(120),
			ValidationRules: &applicationinsights.WebTestPropertiesValidationRulesArgs{
				SSLCertRemainingLifetimeCheck: pulumi.Int(100),
				SSLCheck:                      pulumi.Bool(true),
			},
			WebTestKind: applicationinsights.WebTestKindStandard,
			WebTestName: pulumi.String("my-webtest-my-component"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var webTest = new AzureNative.ApplicationInsights.WebTest("webTest", new()
    {
        Description = "Ping web test alert for mytestwebapp",
        Enabled = true,
        Frequency = 900,
        Location = "South Central US",
        Locations = new[]
        {
            new AzureNative.ApplicationInsights.Inputs.WebTestGeolocationArgs
            {
                Location = "us-fl-mia-edge",
            },
        },
        Request = new AzureNative.ApplicationInsights.Inputs.WebTestPropertiesRequestArgs
        {
            Headers = new[]
            {
                new AzureNative.ApplicationInsights.Inputs.HeaderFieldArgs
                {
                    HeaderFieldName = "Content-Language",
                    HeaderFieldValue = "de-DE",
                },
                new AzureNative.ApplicationInsights.Inputs.HeaderFieldArgs
                {
                    HeaderFieldName = "Accept-Language",
                    HeaderFieldValue = "de-DE",
                },
            },
            HttpVerb = "POST",
            RequestBody = "SGVsbG8gd29ybGQ=",
            RequestUrl = "https://bing.com",
        },
        ResourceGroupName = "my-resource-group",
        RetryEnabled = true,
        SyntheticMonitorId = "my-webtest-my-component",
        Timeout = 120,
        ValidationRules = new AzureNative.ApplicationInsights.Inputs.WebTestPropertiesValidationRulesArgs
        {
            SSLCertRemainingLifetimeCheck = 100,
            SSLCheck = true,
        },
        WebTestKind = AzureNative.ApplicationInsights.WebTestKind.Standard,
        WebTestName = "my-webtest-my-component",
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.applicationinsights.WebTest;
import com.pulumi.azurenative.applicationinsights.WebTestArgs;
import com.pulumi.azurenative.applicationinsights.inputs.WebTestGeolocationArgs;
import com.pulumi.azurenative.applicationinsights.inputs.WebTestPropertiesRequestArgs;
import com.pulumi.azurenative.applicationinsights.inputs.WebTestPropertiesValidationRulesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var webTest = new WebTest("webTest", WebTestArgs.builder()
            .description("Ping web test alert for mytestwebapp")
            .enabled(true)
            .frequency(900)
            .location("South Central US")
            .locations(WebTestGeolocationArgs.builder()
                .location("us-fl-mia-edge")
                .build())
            .request(WebTestPropertiesRequestArgs.builder()
                .headers(                
                    HeaderFieldArgs.builder()
                        .headerFieldName("Content-Language")
                        .headerFieldValue("de-DE")
                        .build(),
                    HeaderFieldArgs.builder()
                        .headerFieldName("Accept-Language")
                        .headerFieldValue("de-DE")
                        .build())
                .httpVerb("POST")
                .requestBody("SGVsbG8gd29ybGQ=")
                .requestUrl("https://bing.com")
                .build())
            .resourceGroupName("my-resource-group")
            .retryEnabled(true)
            .syntheticMonitorId("my-webtest-my-component")
            .timeout(120)
            .validationRules(WebTestPropertiesValidationRulesArgs.builder()
                .sSLCertRemainingLifetimeCheck(100)
                .sSLCheck(true)
                .build())
            .webTestKind("standard")
            .webTestName("my-webtest-my-component")
            .build());

    }
}
resources:
  webTest:
    type: azure-native:applicationinsights:WebTest
    properties:
      description: Ping web test alert for mytestwebapp
      enabled: true
      frequency: 900
      location: South Central US
      locations:
        - location: us-fl-mia-edge
      request:
        headers:
          - headerFieldName: Content-Language
            headerFieldValue: de-DE
          - headerFieldName: Accept-Language
            headerFieldValue: de-DE
        httpVerb: POST
        requestBody: SGVsbG8gd29ybGQ=
        requestUrl: https://bing.com
      resourceGroupName: my-resource-group
      retryEnabled: true
      syntheticMonitorId: my-webtest-my-component
      timeout: 120
      validationRules:
        sSLCertRemainingLifetimeCheck: 100
        sSLCheck: true
      webTestKind: standard
      webTestName: my-webtest-my-component

Standard tests use the request property instead of XML configuration. The httpVerb property sets the HTTP method; requestBody contains base64-encoded payload data. The headers array adds custom HTTP headers to each request. The validationRules property enables SSL certificate checks and sets the minimum remaining certificate lifetime in days before alerting.

Adjust test frequency and geographic coverage

As monitoring requirements evolve, teams modify how often tests run and from which locations to balance coverage against cost.

import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const webTest = new azure_native.applicationinsights.WebTest("webTest", {
    configuration: {
        webTest: "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"30\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"30\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>",
    },
    frequency: 600,
    kind: azure_native.applicationinsights.WebTestKind.Ping,
    location: "South Central US",
    locations: [
        {
            location: "us-fl-mia-edge",
        },
        {
            location: "apac-hk-hkn-azr",
        },
    ],
    resourceGroupName: "my-resource-group",
    syntheticMonitorId: "my-webtest-my-component",
    timeout: 30,
    webTestKind: azure_native.applicationinsights.WebTestKind.Ping,
    webTestName: "my-webtest-my-component",
});
import pulumi
import pulumi_azure_native as azure_native

web_test = azure_native.applicationinsights.WebTest("webTest",
    configuration={
        "web_test": "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"30\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"30\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>",
    },
    frequency=600,
    kind=azure_native.applicationinsights.WebTestKind.PING,
    location="South Central US",
    locations=[
        {
            "location": "us-fl-mia-edge",
        },
        {
            "location": "apac-hk-hkn-azr",
        },
    ],
    resource_group_name="my-resource-group",
    synthetic_monitor_id="my-webtest-my-component",
    timeout=30,
    web_test_kind=azure_native.applicationinsights.WebTestKind.PING,
    web_test_name="my-webtest-my-component")
package main

import (
	applicationinsights "github.com/pulumi/pulumi-azure-native-sdk/applicationinsights/v3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := applicationinsights.NewWebTest(ctx, "webTest", &applicationinsights.WebTestArgs{
			Configuration: &applicationinsights.WebTestPropertiesConfigurationArgs{
				WebTest: pulumi.String("<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"30\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"30\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>"),
			},
			Frequency: pulumi.Int(600),
			Kind:      applicationinsights.WebTestKindPing,
			Location:  pulumi.String("South Central US"),
			Locations: applicationinsights.WebTestGeolocationArray{
				&applicationinsights.WebTestGeolocationArgs{
					Location: pulumi.String("us-fl-mia-edge"),
				},
				&applicationinsights.WebTestGeolocationArgs{
					Location: pulumi.String("apac-hk-hkn-azr"),
				},
			},
			ResourceGroupName:  pulumi.String("my-resource-group"),
			SyntheticMonitorId: pulumi.String("my-webtest-my-component"),
			Timeout:            pulumi.Int(30),
			WebTestKind:        applicationinsights.WebTestKindPing,
			WebTestName:        pulumi.String("my-webtest-my-component"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var webTest = new AzureNative.ApplicationInsights.WebTest("webTest", new()
    {
        Configuration = new AzureNative.ApplicationInsights.Inputs.WebTestPropertiesConfigurationArgs
        {
            WebTest = "<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"30\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"30\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>",
        },
        Frequency = 600,
        Kind = AzureNative.ApplicationInsights.WebTestKind.Ping,
        Location = "South Central US",
        Locations = new[]
        {
            new AzureNative.ApplicationInsights.Inputs.WebTestGeolocationArgs
            {
                Location = "us-fl-mia-edge",
            },
            new AzureNative.ApplicationInsights.Inputs.WebTestGeolocationArgs
            {
                Location = "apac-hk-hkn-azr",
            },
        },
        ResourceGroupName = "my-resource-group",
        SyntheticMonitorId = "my-webtest-my-component",
        Timeout = 30,
        WebTestKind = AzureNative.ApplicationInsights.WebTestKind.Ping,
        WebTestName = "my-webtest-my-component",
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.applicationinsights.WebTest;
import com.pulumi.azurenative.applicationinsights.WebTestArgs;
import com.pulumi.azurenative.applicationinsights.inputs.WebTestPropertiesConfigurationArgs;
import com.pulumi.azurenative.applicationinsights.inputs.WebTestGeolocationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var webTest = new WebTest("webTest", WebTestArgs.builder()
            .configuration(WebTestPropertiesConfigurationArgs.builder()
                .webTest("<WebTest Name=\"my-webtest\" Id=\"678ddf96-1ab8-44c8-9274-123456789abc\" Enabled=\"True\" CssProjectStructure=\"\" CssIteration=\"\" Timeout=\"30\" WorkItemIds=\"\" xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\" Description=\"\" CredentialUserName=\"\" CredentialPassword=\"\" PreAuthenticate=\"True\" Proxy=\"default\" StopOnError=\"False\" RecordedResultFile=\"\" ResultsLocale=\"\" ><Items><Request Method=\"GET\" Guid=\"a4162485-9114-fcfc-e086-123456789abc\" Version=\"1.1\" Url=\"http://my-component.azurewebsites.net\" ThinkTime=\"0\" Timeout=\"30\" ParseDependentRequests=\"True\" FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\" ResponseTimeGoal=\"0\" Encoding=\"utf-8\" ExpectedHttpStatusCode=\"200\" ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" /></Items></WebTest>")
                .build())
            .frequency(600)
            .kind("ping")
            .location("South Central US")
            .locations(            
                WebTestGeolocationArgs.builder()
                    .location("us-fl-mia-edge")
                    .build(),
                WebTestGeolocationArgs.builder()
                    .location("apac-hk-hkn-azr")
                    .build())
            .resourceGroupName("my-resource-group")
            .syntheticMonitorId("my-webtest-my-component")
            .timeout(30)
            .webTestKind("ping")
            .webTestName("my-webtest-my-component")
            .build());

    }
}
resources:
  webTest:
    type: azure-native:applicationinsights:WebTest
    properties:
      configuration:
        webTest: <WebTest Name="my-webtest" Id="678ddf96-1ab8-44c8-9274-123456789abc" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="30" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="default" StopOnError="False" RecordedResultFile="" ResultsLocale="" ><Items><Request Method="GET" Guid="a4162485-9114-fcfc-e086-123456789abc" Version="1.1" Url="http://my-component.azurewebsites.net" ThinkTime="0" Timeout="30" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="200" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" /></Items></WebTest>
      frequency: 600
      kind: ping
      location: South Central US
      locations:
        - location: us-fl-mia-edge
        - location: apac-hk-hkn-azr
      resourceGroupName: my-resource-group
      syntheticMonitorId: my-webtest-my-component
      timeout: 30
      webTestKind: ping
      webTestName: my-webtest-my-component

The frequency property controls test intervals in seconds; here, tests run every 600 seconds (10 minutes) instead of the default 300. The timeout property sets how long to wait for responses before marking the test as failed. Adding a second location in the locations array provides coverage from both Miami and Hong Kong, detecting regional availability issues.

Beyond these examples

These snippets focus on specific WebTest features: ping and standard test types, geographic distribution and test frequency, and HTTP request customization and SSL validation. They’re intentionally minimal rather than full monitoring solutions.

The examples reference pre-existing infrastructure such as Azure resource groups and Application Insights components (implied by syntheticMonitorId). They focus on configuring the test rather than provisioning the surrounding monitoring infrastructure.

To keep things focused, common WebTest patterns are omitted, including:

  • Multi-step tests (webTestKind: multistep)
  • Alert rules and action groups for test failures
  • Authentication configuration (CredentialUserName, CredentialPassword)
  • Content validation and expected response patterns

These omissions are intentional: the goal is to illustrate how each WebTest feature is wired, not provide drop-in monitoring modules. See the WebTest resource reference for all available configuration options.

Let's configure Azure Application Insights Web Tests

Get started with Pulumi Cloud, then follow our quick setup guide to deploy this infrastructure.

Try Pulumi Cloud for FREE

Frequently Asked Questions

Test Types & Configuration
What's the difference between ping and standard web tests?
Ping tests use configuration with an XML WebTest definition. Standard tests use request with structured properties like httpVerb, requestUrl, headers, and requestBody. Standard tests offer more flexibility for complex scenarios like POST requests and custom headers.
What's the difference between kind and webTestKind properties?
Both properties describe the test type (ping, multistep, or standard) and default to “ping”. Use webTestKind as it’s the required property; kind appears redundant.
How do I send a POST request with a body in my web test?
Set webTestKind to “standard”, then configure request with httpVerb: "POST" and requestBody containing your base64-encoded payload.
How do I add custom headers to my web test?
Use the request.headers array with headerFieldName and headerFieldValue properties. This is available in standard tests.
Timing & Execution
What are the default timing settings for web tests?
Web tests default to a 30-second timeout and run every 300 seconds (5 minutes). You can configure timeout up to your needs and adjust frequency for different monitoring intervals.
Can I automatically retry failed tests?
Yes, set retryEnabled: true to allow retries when the WebTest fails.
Locations & Monitoring
How do I test from multiple geographic locations?
Add multiple entries to the locations array with different location codes (e.g., “us-fl-mia-edge”, “apac-hk-hkn-azr”) to provide global coverage for your application.
Can I temporarily disable a web test without deleting it?
Yes, set enabled: false to stop active monitoring while keeping the test configuration.
Advanced Features
How do I enable SSL certificate validation?
Configure validationRules with sSLCheck: true. You can also set sSLCertRemainingLifetimeCheck to specify the minimum remaining certificate lifetime in days.
Resource Properties
Can I change the location after creating a web test?
No, the location property is immutable and cannot be changed after resource creation. Plan your resource location carefully during initial setup.
What's the syntheticMonitorId used for?
It’s a required unique identifier for the WebTest. Typically, you set this to the same value as webTestName for consistency.

Using a different cloud?

Explore monitoring guides for other cloud providers: