Configure Azure Traffic Manager Profiles

The azure-native:trafficmanager:Profile resource, part of the Pulumi Azure Native provider, defines a Traffic Manager profile that routes DNS queries across multiple endpoints based on routing methods and health monitoring. This guide focuses on four capabilities: DNS and routing configuration, external endpoint targeting, health check customization, and nested profile hierarchies.

Traffic Manager profiles require an Azure resource group and may reference external domains or other Traffic Manager profiles as endpoints. The examples are intentionally small. Combine them with your own endpoint infrastructure and monitoring requirements.

Create a profile with routing and monitoring

Most deployments start by defining the DNS name, routing method, and health monitoring configuration before adding endpoints.

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

const profile = new azure_native.trafficmanager.Profile("profile", {
    dnsConfig: {
        relativeName: "azsmnet6386",
        ttl: 35,
    },
    location: "global",
    monitorConfig: {
        path: "/testpath.aspx",
        port: 80,
        protocol: azure_native.trafficmanager.MonitorProtocol.HTTP,
    },
    profileName: "azsmnet6386",
    profileStatus: azure_native.trafficmanager.ProfileStatus.Enabled,
    resourceGroupName: "azuresdkfornetautoresttrafficmanager1421",
    trafficRoutingMethod: azure_native.trafficmanager.TrafficRoutingMethod.Performance,
});
import pulumi
import pulumi_azure_native as azure_native

profile = azure_native.trafficmanager.Profile("profile",
    dns_config={
        "relative_name": "azsmnet6386",
        "ttl": 35,
    },
    location="global",
    monitor_config={
        "path": "/testpath.aspx",
        "port": 80,
        "protocol": azure_native.trafficmanager.MonitorProtocol.HTTP,
    },
    profile_name="azsmnet6386",
    profile_status=azure_native.trafficmanager.ProfileStatus.ENABLED,
    resource_group_name="azuresdkfornetautoresttrafficmanager1421",
    traffic_routing_method=azure_native.trafficmanager.TrafficRoutingMethod.PERFORMANCE)
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := trafficmanager.NewProfile(ctx, "profile", &trafficmanager.ProfileArgs{
			DnsConfig: &trafficmanager.DnsConfigArgs{
				RelativeName: pulumi.String("azsmnet6386"),
				Ttl:          pulumi.Float64(35),
			},
			Location: pulumi.String("global"),
			MonitorConfig: &trafficmanager.MonitorConfigArgs{
				Path:     pulumi.String("/testpath.aspx"),
				Port:     pulumi.Float64(80),
				Protocol: pulumi.String(trafficmanager.MonitorProtocolHTTP),
			},
			ProfileName:          pulumi.String("azsmnet6386"),
			ProfileStatus:        pulumi.String(trafficmanager.ProfileStatusEnabled),
			ResourceGroupName:    pulumi.String("azuresdkfornetautoresttrafficmanager1421"),
			TrafficRoutingMethod: pulumi.String(trafficmanager.TrafficRoutingMethodPerformance),
		})
		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 profile = new AzureNative.TrafficManager.Profile("profile", new()
    {
        DnsConfig = new AzureNative.TrafficManager.Inputs.DnsConfigArgs
        {
            RelativeName = "azsmnet6386",
            Ttl = 35,
        },
        Location = "global",
        MonitorConfig = new AzureNative.TrafficManager.Inputs.MonitorConfigArgs
        {
            Path = "/testpath.aspx",
            Port = 80,
            Protocol = AzureNative.TrafficManager.MonitorProtocol.HTTP,
        },
        ProfileName = "azsmnet6386",
        ProfileStatus = AzureNative.TrafficManager.ProfileStatus.Enabled,
        ResourceGroupName = "azuresdkfornetautoresttrafficmanager1421",
        TrafficRoutingMethod = AzureNative.TrafficManager.TrafficRoutingMethod.Performance,
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.trafficmanager.Profile;
import com.pulumi.azurenative.trafficmanager.ProfileArgs;
import com.pulumi.azurenative.trafficmanager.inputs.DnsConfigArgs;
import com.pulumi.azurenative.trafficmanager.inputs.MonitorConfigArgs;
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 profile = new Profile("profile", ProfileArgs.builder()
            .dnsConfig(DnsConfigArgs.builder()
                .relativeName("azsmnet6386")
                .ttl(35.0)
                .build())
            .location("global")
            .monitorConfig(MonitorConfigArgs.builder()
                .path("/testpath.aspx")
                .port(80.0)
                .protocol("HTTP")
                .build())
            .profileName("azsmnet6386")
            .profileStatus("Enabled")
            .resourceGroupName("azuresdkfornetautoresttrafficmanager1421")
            .trafficRoutingMethod("Performance")
            .build());

    }
}
resources:
  profile:
    type: azure-native:trafficmanager:Profile
    properties:
      dnsConfig:
        relativeName: azsmnet6386
        ttl: 35
      location: global
      monitorConfig:
        path: /testpath.aspx
        port: 80
        protocol: HTTP
      profileName: azsmnet6386
      profileStatus: Enabled
      resourceGroupName: azuresdkfornetautoresttrafficmanager1421
      trafficRoutingMethod: Performance

The dnsConfig block sets the DNS subdomain (relativeName) and TTL for DNS responses. The trafficRoutingMethod determines how Traffic Manager selects endpoints: Performance routes to the lowest-latency target, Priority uses a failover order, and MultiValue returns multiple healthy endpoints. The monitorConfig defines health probe behavior: Traffic Manager sends HTTP requests to the specified path and port, marking endpoints unhealthy if they fail the configured number of checks.

Route traffic to external endpoints

Applications often distribute traffic to external services or third-party domains that aren’t hosted in Azure.

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

const profile = new azure_native.trafficmanager.Profile("profile", {
    dnsConfig: {
        relativeName: "azuresdkfornetautoresttrafficmanager6192",
        ttl: 35,
    },
    endpoints: [{
        endpointLocation: "North Europe",
        endpointStatus: azure_native.trafficmanager.EndpointStatus.Enabled,
        name: "My external endpoint",
        target: "foobar.contoso.com",
        type: "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
    }],
    location: "global",
    monitorConfig: {
        intervalInSeconds: 10,
        path: "/testpath.aspx",
        port: 80,
        protocol: azure_native.trafficmanager.MonitorProtocol.HTTP,
        timeoutInSeconds: 5,
        toleratedNumberOfFailures: 2,
    },
    profileName: "azuresdkfornetautoresttrafficmanager6192",
    profileStatus: azure_native.trafficmanager.ProfileStatus.Enabled,
    resourceGroupName: "azuresdkfornetautoresttrafficmanager2583",
    trafficRoutingMethod: azure_native.trafficmanager.TrafficRoutingMethod.Performance,
});
import pulumi
import pulumi_azure_native as azure_native

profile = azure_native.trafficmanager.Profile("profile",
    dns_config={
        "relative_name": "azuresdkfornetautoresttrafficmanager6192",
        "ttl": 35,
    },
    endpoints=[{
        "endpoint_location": "North Europe",
        "endpoint_status": azure_native.trafficmanager.EndpointStatus.ENABLED,
        "name": "My external endpoint",
        "target": "foobar.contoso.com",
        "type": "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
    }],
    location="global",
    monitor_config={
        "interval_in_seconds": 10,
        "path": "/testpath.aspx",
        "port": 80,
        "protocol": azure_native.trafficmanager.MonitorProtocol.HTTP,
        "timeout_in_seconds": 5,
        "tolerated_number_of_failures": 2,
    },
    profile_name="azuresdkfornetautoresttrafficmanager6192",
    profile_status=azure_native.trafficmanager.ProfileStatus.ENABLED,
    resource_group_name="azuresdkfornetautoresttrafficmanager2583",
    traffic_routing_method=azure_native.trafficmanager.TrafficRoutingMethod.PERFORMANCE)
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := trafficmanager.NewProfile(ctx, "profile", &trafficmanager.ProfileArgs{
			DnsConfig: &trafficmanager.DnsConfigArgs{
				RelativeName: pulumi.String("azuresdkfornetautoresttrafficmanager6192"),
				Ttl:          pulumi.Float64(35),
			},
			Endpoints: trafficmanager.EndpointTypeArray{
				&trafficmanager.EndpointTypeArgs{
					EndpointLocation: pulumi.String("North Europe"),
					EndpointStatus:   pulumi.String(trafficmanager.EndpointStatusEnabled),
					Name:             pulumi.String("My external endpoint"),
					Target:           pulumi.String("foobar.contoso.com"),
					Type:             pulumi.String("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints"),
				},
			},
			Location: pulumi.String("global"),
			MonitorConfig: &trafficmanager.MonitorConfigArgs{
				IntervalInSeconds:         pulumi.Float64(10),
				Path:                      pulumi.String("/testpath.aspx"),
				Port:                      pulumi.Float64(80),
				Protocol:                  pulumi.String(trafficmanager.MonitorProtocolHTTP),
				TimeoutInSeconds:          pulumi.Float64(5),
				ToleratedNumberOfFailures: pulumi.Float64(2),
			},
			ProfileName:          pulumi.String("azuresdkfornetautoresttrafficmanager6192"),
			ProfileStatus:        pulumi.String(trafficmanager.ProfileStatusEnabled),
			ResourceGroupName:    pulumi.String("azuresdkfornetautoresttrafficmanager2583"),
			TrafficRoutingMethod: pulumi.String(trafficmanager.TrafficRoutingMethodPerformance),
		})
		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 profile = new AzureNative.TrafficManager.Profile("profile", new()
    {
        DnsConfig = new AzureNative.TrafficManager.Inputs.DnsConfigArgs
        {
            RelativeName = "azuresdkfornetautoresttrafficmanager6192",
            Ttl = 35,
        },
        Endpoints = new[]
        {
            new AzureNative.TrafficManager.Inputs.EndpointArgs
            {
                EndpointLocation = "North Europe",
                EndpointStatus = AzureNative.TrafficManager.EndpointStatus.Enabled,
                Name = "My external endpoint",
                Target = "foobar.contoso.com",
                Type = "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
            },
        },
        Location = "global",
        MonitorConfig = new AzureNative.TrafficManager.Inputs.MonitorConfigArgs
        {
            IntervalInSeconds = 10,
            Path = "/testpath.aspx",
            Port = 80,
            Protocol = AzureNative.TrafficManager.MonitorProtocol.HTTP,
            TimeoutInSeconds = 5,
            ToleratedNumberOfFailures = 2,
        },
        ProfileName = "azuresdkfornetautoresttrafficmanager6192",
        ProfileStatus = AzureNative.TrafficManager.ProfileStatus.Enabled,
        ResourceGroupName = "azuresdkfornetautoresttrafficmanager2583",
        TrafficRoutingMethod = AzureNative.TrafficManager.TrafficRoutingMethod.Performance,
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.trafficmanager.Profile;
import com.pulumi.azurenative.trafficmanager.ProfileArgs;
import com.pulumi.azurenative.trafficmanager.inputs.DnsConfigArgs;
import com.pulumi.azurenative.trafficmanager.inputs.EndpointArgs;
import com.pulumi.azurenative.trafficmanager.inputs.MonitorConfigArgs;
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 profile = new Profile("profile", ProfileArgs.builder()
            .dnsConfig(DnsConfigArgs.builder()
                .relativeName("azuresdkfornetautoresttrafficmanager6192")
                .ttl(35.0)
                .build())
            .endpoints(EndpointArgs.builder()
                .endpointLocation("North Europe")
                .endpointStatus("Enabled")
                .name("My external endpoint")
                .target("foobar.contoso.com")
                .type("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints")
                .build())
            .location("global")
            .monitorConfig(MonitorConfigArgs.builder()
                .intervalInSeconds(10.0)
                .path("/testpath.aspx")
                .port(80.0)
                .protocol("HTTP")
                .timeoutInSeconds(5.0)
                .toleratedNumberOfFailures(2.0)
                .build())
            .profileName("azuresdkfornetautoresttrafficmanager6192")
            .profileStatus("Enabled")
            .resourceGroupName("azuresdkfornetautoresttrafficmanager2583")
            .trafficRoutingMethod("Performance")
            .build());

    }
}
resources:
  profile:
    type: azure-native:trafficmanager:Profile
    properties:
      dnsConfig:
        relativeName: azuresdkfornetautoresttrafficmanager6192
        ttl: 35
      endpoints:
        - endpointLocation: North Europe
          endpointStatus: Enabled
          name: My external endpoint
          target: foobar.contoso.com
          type: Microsoft.network/TrafficManagerProfiles/ExternalEndpoints
      location: global
      monitorConfig:
        intervalInSeconds: 10
        path: /testpath.aspx
        port: 80
        protocol: HTTP
        timeoutInSeconds: 5
        toleratedNumberOfFailures: 2
      profileName: azuresdkfornetautoresttrafficmanager6192
      profileStatus: Enabled
      resourceGroupName: azuresdkfornetautoresttrafficmanager2583
      trafficRoutingMethod: Performance

The endpoints array defines where Traffic Manager routes queries. Each endpoint specifies a target (the domain name), endpointLocation (for Performance routing), and endpointStatus (Enabled or Disabled). The type field identifies this as an external endpoint rather than an Azure resource. Traffic Manager probes each endpoint using the monitorConfig settings and removes unhealthy targets from DNS responses.

Add custom headers to health checks

Health probes sometimes need to pass authentication tokens or routing hints to backend services.

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

const profile = new azure_native.trafficmanager.Profile("profile", {
    dnsConfig: {
        relativeName: "azuresdkfornetautoresttrafficmanager6192",
        ttl: 35,
    },
    endpoints: [{
        customHeaders: [{
            name: "header-2",
            value: "value-2-overridden",
        }],
        endpointLocation: "North Europe",
        endpointStatus: azure_native.trafficmanager.EndpointStatus.Enabled,
        name: "My external endpoint",
        target: "foobar.contoso.com",
        type: "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
    }],
    location: "global",
    monitorConfig: {
        customHeaders: [
            {
                name: "header-1",
                value: "value-1",
            },
            {
                name: "header-2",
                value: "value-2",
            },
        ],
        expectedStatusCodeRanges: [
            {
                max: 205,
                min: 200,
            },
            {
                max: 410,
                min: 400,
            },
        ],
        intervalInSeconds: 10,
        path: "/testpath.aspx",
        port: 80,
        protocol: azure_native.trafficmanager.MonitorProtocol.HTTP,
        timeoutInSeconds: 5,
        toleratedNumberOfFailures: 2,
    },
    profileName: "azuresdkfornetautoresttrafficmanager6192",
    profileStatus: azure_native.trafficmanager.ProfileStatus.Enabled,
    resourceGroupName: "azuresdkfornetautoresttrafficmanager2583",
    trafficRoutingMethod: azure_native.trafficmanager.TrafficRoutingMethod.Performance,
    trafficViewEnrollmentStatus: azure_native.trafficmanager.TrafficViewEnrollmentStatus.Disabled,
});
import pulumi
import pulumi_azure_native as azure_native

profile = azure_native.trafficmanager.Profile("profile",
    dns_config={
        "relative_name": "azuresdkfornetautoresttrafficmanager6192",
        "ttl": 35,
    },
    endpoints=[{
        "custom_headers": [{
            "name": "header-2",
            "value": "value-2-overridden",
        }],
        "endpoint_location": "North Europe",
        "endpoint_status": azure_native.trafficmanager.EndpointStatus.ENABLED,
        "name": "My external endpoint",
        "target": "foobar.contoso.com",
        "type": "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
    }],
    location="global",
    monitor_config={
        "custom_headers": [
            {
                "name": "header-1",
                "value": "value-1",
            },
            {
                "name": "header-2",
                "value": "value-2",
            },
        ],
        "expected_status_code_ranges": [
            {
                "max": 205,
                "min": 200,
            },
            {
                "max": 410,
                "min": 400,
            },
        ],
        "interval_in_seconds": 10,
        "path": "/testpath.aspx",
        "port": 80,
        "protocol": azure_native.trafficmanager.MonitorProtocol.HTTP,
        "timeout_in_seconds": 5,
        "tolerated_number_of_failures": 2,
    },
    profile_name="azuresdkfornetautoresttrafficmanager6192",
    profile_status=azure_native.trafficmanager.ProfileStatus.ENABLED,
    resource_group_name="azuresdkfornetautoresttrafficmanager2583",
    traffic_routing_method=azure_native.trafficmanager.TrafficRoutingMethod.PERFORMANCE,
    traffic_view_enrollment_status=azure_native.trafficmanager.TrafficViewEnrollmentStatus.DISABLED)
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := trafficmanager.NewProfile(ctx, "profile", &trafficmanager.ProfileArgs{
			DnsConfig: &trafficmanager.DnsConfigArgs{
				RelativeName: pulumi.String("azuresdkfornetautoresttrafficmanager6192"),
				Ttl:          pulumi.Float64(35),
			},
			Endpoints: trafficmanager.EndpointTypeArray{
				&trafficmanager.EndpointTypeArgs{
					CustomHeaders: trafficmanager.EndpointPropertiesCustomHeadersItemArray{
						&trafficmanager.EndpointPropertiesCustomHeadersItemArgs{
							Name:  pulumi.String("header-2"),
							Value: pulumi.String("value-2-overridden"),
						},
					},
					EndpointLocation: pulumi.String("North Europe"),
					EndpointStatus:   pulumi.String(trafficmanager.EndpointStatusEnabled),
					Name:             pulumi.String("My external endpoint"),
					Target:           pulumi.String("foobar.contoso.com"),
					Type:             pulumi.String("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints"),
				},
			},
			Location: pulumi.String("global"),
			MonitorConfig: &trafficmanager.MonitorConfigArgs{
				CustomHeaders: trafficmanager.MonitorConfigCustomHeadersItemArray{
					&trafficmanager.MonitorConfigCustomHeadersItemArgs{
						Name:  pulumi.String("header-1"),
						Value: pulumi.String("value-1"),
					},
					&trafficmanager.MonitorConfigCustomHeadersItemArgs{
						Name:  pulumi.String("header-2"),
						Value: pulumi.String("value-2"),
					},
				},
				ExpectedStatusCodeRanges: trafficmanager.MonitorConfigExpectedStatusCodeRangesItemArray{
					&trafficmanager.MonitorConfigExpectedStatusCodeRangesItemArgs{
						Max: pulumi.Int(205),
						Min: pulumi.Int(200),
					},
					&trafficmanager.MonitorConfigExpectedStatusCodeRangesItemArgs{
						Max: pulumi.Int(410),
						Min: pulumi.Int(400),
					},
				},
				IntervalInSeconds:         pulumi.Float64(10),
				Path:                      pulumi.String("/testpath.aspx"),
				Port:                      pulumi.Float64(80),
				Protocol:                  pulumi.String(trafficmanager.MonitorProtocolHTTP),
				TimeoutInSeconds:          pulumi.Float64(5),
				ToleratedNumberOfFailures: pulumi.Float64(2),
			},
			ProfileName:                 pulumi.String("azuresdkfornetautoresttrafficmanager6192"),
			ProfileStatus:               pulumi.String(trafficmanager.ProfileStatusEnabled),
			ResourceGroupName:           pulumi.String("azuresdkfornetautoresttrafficmanager2583"),
			TrafficRoutingMethod:        pulumi.String(trafficmanager.TrafficRoutingMethodPerformance),
			TrafficViewEnrollmentStatus: pulumi.String(trafficmanager.TrafficViewEnrollmentStatusDisabled),
		})
		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 profile = new AzureNative.TrafficManager.Profile("profile", new()
    {
        DnsConfig = new AzureNative.TrafficManager.Inputs.DnsConfigArgs
        {
            RelativeName = "azuresdkfornetautoresttrafficmanager6192",
            Ttl = 35,
        },
        Endpoints = new[]
        {
            new AzureNative.TrafficManager.Inputs.EndpointArgs
            {
                CustomHeaders = new[]
                {
                    new AzureNative.TrafficManager.Inputs.EndpointPropertiesCustomHeadersItemArgs
                    {
                        Name = "header-2",
                        Value = "value-2-overridden",
                    },
                },
                EndpointLocation = "North Europe",
                EndpointStatus = AzureNative.TrafficManager.EndpointStatus.Enabled,
                Name = "My external endpoint",
                Target = "foobar.contoso.com",
                Type = "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
            },
        },
        Location = "global",
        MonitorConfig = new AzureNative.TrafficManager.Inputs.MonitorConfigArgs
        {
            CustomHeaders = new[]
            {
                new AzureNative.TrafficManager.Inputs.MonitorConfigCustomHeadersItemArgs
                {
                    Name = "header-1",
                    Value = "value-1",
                },
                new AzureNative.TrafficManager.Inputs.MonitorConfigCustomHeadersItemArgs
                {
                    Name = "header-2",
                    Value = "value-2",
                },
            },
            ExpectedStatusCodeRanges = new[]
            {
                new AzureNative.TrafficManager.Inputs.MonitorConfigExpectedStatusCodeRangesItemArgs
                {
                    Max = 205,
                    Min = 200,
                },
                new AzureNative.TrafficManager.Inputs.MonitorConfigExpectedStatusCodeRangesItemArgs
                {
                    Max = 410,
                    Min = 400,
                },
            },
            IntervalInSeconds = 10,
            Path = "/testpath.aspx",
            Port = 80,
            Protocol = AzureNative.TrafficManager.MonitorProtocol.HTTP,
            TimeoutInSeconds = 5,
            ToleratedNumberOfFailures = 2,
        },
        ProfileName = "azuresdkfornetautoresttrafficmanager6192",
        ProfileStatus = AzureNative.TrafficManager.ProfileStatus.Enabled,
        ResourceGroupName = "azuresdkfornetautoresttrafficmanager2583",
        TrafficRoutingMethod = AzureNative.TrafficManager.TrafficRoutingMethod.Performance,
        TrafficViewEnrollmentStatus = AzureNative.TrafficManager.TrafficViewEnrollmentStatus.Disabled,
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.trafficmanager.Profile;
import com.pulumi.azurenative.trafficmanager.ProfileArgs;
import com.pulumi.azurenative.trafficmanager.inputs.DnsConfigArgs;
import com.pulumi.azurenative.trafficmanager.inputs.EndpointArgs;
import com.pulumi.azurenative.trafficmanager.inputs.MonitorConfigArgs;
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 profile = new Profile("profile", ProfileArgs.builder()
            .dnsConfig(DnsConfigArgs.builder()
                .relativeName("azuresdkfornetautoresttrafficmanager6192")
                .ttl(35.0)
                .build())
            .endpoints(EndpointArgs.builder()
                .customHeaders(EndpointPropertiesCustomHeadersItemArgs.builder()
                    .name("header-2")
                    .value("value-2-overridden")
                    .build())
                .endpointLocation("North Europe")
                .endpointStatus("Enabled")
                .name("My external endpoint")
                .target("foobar.contoso.com")
                .type("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints")
                .build())
            .location("global")
            .monitorConfig(MonitorConfigArgs.builder()
                .customHeaders(                
                    MonitorConfigCustomHeadersItemArgs.builder()
                        .name("header-1")
                        .value("value-1")
                        .build(),
                    MonitorConfigCustomHeadersItemArgs.builder()
                        .name("header-2")
                        .value("value-2")
                        .build())
                .expectedStatusCodeRanges(                
                    MonitorConfigExpectedStatusCodeRangesItemArgs.builder()
                        .max(205)
                        .min(200)
                        .build(),
                    MonitorConfigExpectedStatusCodeRangesItemArgs.builder()
                        .max(410)
                        .min(400)
                        .build())
                .intervalInSeconds(10.0)
                .path("/testpath.aspx")
                .port(80.0)
                .protocol("HTTP")
                .timeoutInSeconds(5.0)
                .toleratedNumberOfFailures(2.0)
                .build())
            .profileName("azuresdkfornetautoresttrafficmanager6192")
            .profileStatus("Enabled")
            .resourceGroupName("azuresdkfornetautoresttrafficmanager2583")
            .trafficRoutingMethod("Performance")
            .trafficViewEnrollmentStatus("Disabled")
            .build());

    }
}
resources:
  profile:
    type: azure-native:trafficmanager:Profile
    properties:
      dnsConfig:
        relativeName: azuresdkfornetautoresttrafficmanager6192
        ttl: 35
      endpoints:
        - customHeaders:
            - name: header-2
              value: value-2-overridden
          endpointLocation: North Europe
          endpointStatus: Enabled
          name: My external endpoint
          target: foobar.contoso.com
          type: Microsoft.network/TrafficManagerProfiles/ExternalEndpoints
      location: global
      monitorConfig:
        customHeaders:
          - name: header-1
            value: value-1
          - name: header-2
            value: value-2
        expectedStatusCodeRanges:
          - max: 205
            min: 200
          - max: 410
            min: 400
        intervalInSeconds: 10
        path: /testpath.aspx
        port: 80
        protocol: HTTP
        timeoutInSeconds: 5
        toleratedNumberOfFailures: 2
      profileName: azuresdkfornetautoresttrafficmanager6192
      profileStatus: Enabled
      resourceGroupName: azuresdkfornetautoresttrafficmanager2583
      trafficRoutingMethod: Performance
      trafficViewEnrollmentStatus: Disabled

Custom headers in monitorConfig apply to all endpoints, while per-endpoint customHeaders override profile-level values. The expectedStatusCodeRanges property lets you define multiple HTTP status ranges as healthy (e.g., 200-205 and 400-410). Traffic Manager evaluates these ranges against probe responses, marking endpoints healthy only when they return matching codes.

Build hierarchical routing with nested profiles

Complex deployments often layer Traffic Manager profiles to create multi-tier routing hierarchies.

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

const profile = new azure_native.trafficmanager.Profile("profile", {
    dnsConfig: {
        relativeName: "parentprofile",
        ttl: 35,
    },
    endpoints: [
        {
            endpointStatus: azure_native.trafficmanager.EndpointStatus.Enabled,
            minChildEndpoints: 2,
            minChildEndpointsIPv4: 1,
            minChildEndpointsIPv6: 2,
            name: "MyFirstNestedEndpoint",
            priority: 1,
            target: "firstnestedprofile.tmpreview.watmtest.azure-test.net",
            type: "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
            weight: 1,
        },
        {
            endpointStatus: azure_native.trafficmanager.EndpointStatus.Enabled,
            minChildEndpoints: 2,
            minChildEndpointsIPv4: 2,
            minChildEndpointsIPv6: 1,
            name: "MySecondNestedEndpoint",
            priority: 2,
            target: "secondnestedprofile.tmpreview.watmtest.azure-test.net",
            type: "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
            weight: 1,
        },
    ],
    location: "global",
    monitorConfig: {
        intervalInSeconds: 10,
        path: "/testpath.aspx",
        port: 80,
        protocol: azure_native.trafficmanager.MonitorProtocol.HTTP,
        timeoutInSeconds: 5,
        toleratedNumberOfFailures: 2,
    },
    profileName: "parentprofile",
    profileStatus: azure_native.trafficmanager.ProfileStatus.Enabled,
    resourceGroupName: "myresourcegroup",
    trafficRoutingMethod: azure_native.trafficmanager.TrafficRoutingMethod.Priority,
});
import pulumi
import pulumi_azure_native as azure_native

profile = azure_native.trafficmanager.Profile("profile",
    dns_config={
        "relative_name": "parentprofile",
        "ttl": 35,
    },
    endpoints=[
        {
            "endpoint_status": azure_native.trafficmanager.EndpointStatus.ENABLED,
            "min_child_endpoints": 2,
            "min_child_endpoints_i_pv4": 1,
            "min_child_endpoints_i_pv6": 2,
            "name": "MyFirstNestedEndpoint",
            "priority": 1,
            "target": "firstnestedprofile.tmpreview.watmtest.azure-test.net",
            "type": "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
            "weight": 1,
        },
        {
            "endpoint_status": azure_native.trafficmanager.EndpointStatus.ENABLED,
            "min_child_endpoints": 2,
            "min_child_endpoints_i_pv4": 2,
            "min_child_endpoints_i_pv6": 1,
            "name": "MySecondNestedEndpoint",
            "priority": 2,
            "target": "secondnestedprofile.tmpreview.watmtest.azure-test.net",
            "type": "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
            "weight": 1,
        },
    ],
    location="global",
    monitor_config={
        "interval_in_seconds": 10,
        "path": "/testpath.aspx",
        "port": 80,
        "protocol": azure_native.trafficmanager.MonitorProtocol.HTTP,
        "timeout_in_seconds": 5,
        "tolerated_number_of_failures": 2,
    },
    profile_name="parentprofile",
    profile_status=azure_native.trafficmanager.ProfileStatus.ENABLED,
    resource_group_name="myresourcegroup",
    traffic_routing_method=azure_native.trafficmanager.TrafficRoutingMethod.PRIORITY)
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := trafficmanager.NewProfile(ctx, "profile", &trafficmanager.ProfileArgs{
			DnsConfig: &trafficmanager.DnsConfigArgs{
				RelativeName: pulumi.String("parentprofile"),
				Ttl:          pulumi.Float64(35),
			},
			Endpoints: trafficmanager.EndpointTypeArray{
				&trafficmanager.EndpointTypeArgs{
					EndpointStatus:        pulumi.String(trafficmanager.EndpointStatusEnabled),
					MinChildEndpoints:     pulumi.Float64(2),
					MinChildEndpointsIPv4: pulumi.Float64(1),
					MinChildEndpointsIPv6: pulumi.Float64(2),
					Name:                  pulumi.String("MyFirstNestedEndpoint"),
					Priority:              pulumi.Float64(1),
					Target:                pulumi.String("firstnestedprofile.tmpreview.watmtest.azure-test.net"),
					Type:                  pulumi.String("Microsoft.Network/trafficManagerProfiles/nestedEndpoints"),
					Weight:                pulumi.Float64(1),
				},
				&trafficmanager.EndpointTypeArgs{
					EndpointStatus:        pulumi.String(trafficmanager.EndpointStatusEnabled),
					MinChildEndpoints:     pulumi.Float64(2),
					MinChildEndpointsIPv4: pulumi.Float64(2),
					MinChildEndpointsIPv6: pulumi.Float64(1),
					Name:                  pulumi.String("MySecondNestedEndpoint"),
					Priority:              pulumi.Float64(2),
					Target:                pulumi.String("secondnestedprofile.tmpreview.watmtest.azure-test.net"),
					Type:                  pulumi.String("Microsoft.Network/trafficManagerProfiles/nestedEndpoints"),
					Weight:                pulumi.Float64(1),
				},
			},
			Location: pulumi.String("global"),
			MonitorConfig: &trafficmanager.MonitorConfigArgs{
				IntervalInSeconds:         pulumi.Float64(10),
				Path:                      pulumi.String("/testpath.aspx"),
				Port:                      pulumi.Float64(80),
				Protocol:                  pulumi.String(trafficmanager.MonitorProtocolHTTP),
				TimeoutInSeconds:          pulumi.Float64(5),
				ToleratedNumberOfFailures: pulumi.Float64(2),
			},
			ProfileName:          pulumi.String("parentprofile"),
			ProfileStatus:        pulumi.String(trafficmanager.ProfileStatusEnabled),
			ResourceGroupName:    pulumi.String("myresourcegroup"),
			TrafficRoutingMethod: pulumi.String(trafficmanager.TrafficRoutingMethodPriority),
		})
		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 profile = new AzureNative.TrafficManager.Profile("profile", new()
    {
        DnsConfig = new AzureNative.TrafficManager.Inputs.DnsConfigArgs
        {
            RelativeName = "parentprofile",
            Ttl = 35,
        },
        Endpoints = new[]
        {
            new AzureNative.TrafficManager.Inputs.EndpointArgs
            {
                EndpointStatus = AzureNative.TrafficManager.EndpointStatus.Enabled,
                MinChildEndpoints = 2,
                MinChildEndpointsIPv4 = 1,
                MinChildEndpointsIPv6 = 2,
                Name = "MyFirstNestedEndpoint",
                Priority = 1,
                Target = "firstnestedprofile.tmpreview.watmtest.azure-test.net",
                Type = "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
                Weight = 1,
            },
            new AzureNative.TrafficManager.Inputs.EndpointArgs
            {
                EndpointStatus = AzureNative.TrafficManager.EndpointStatus.Enabled,
                MinChildEndpoints = 2,
                MinChildEndpointsIPv4 = 2,
                MinChildEndpointsIPv6 = 1,
                Name = "MySecondNestedEndpoint",
                Priority = 2,
                Target = "secondnestedprofile.tmpreview.watmtest.azure-test.net",
                Type = "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
                Weight = 1,
            },
        },
        Location = "global",
        MonitorConfig = new AzureNative.TrafficManager.Inputs.MonitorConfigArgs
        {
            IntervalInSeconds = 10,
            Path = "/testpath.aspx",
            Port = 80,
            Protocol = AzureNative.TrafficManager.MonitorProtocol.HTTP,
            TimeoutInSeconds = 5,
            ToleratedNumberOfFailures = 2,
        },
        ProfileName = "parentprofile",
        ProfileStatus = AzureNative.TrafficManager.ProfileStatus.Enabled,
        ResourceGroupName = "myresourcegroup",
        TrafficRoutingMethod = AzureNative.TrafficManager.TrafficRoutingMethod.Priority,
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.trafficmanager.Profile;
import com.pulumi.azurenative.trafficmanager.ProfileArgs;
import com.pulumi.azurenative.trafficmanager.inputs.DnsConfigArgs;
import com.pulumi.azurenative.trafficmanager.inputs.EndpointArgs;
import com.pulumi.azurenative.trafficmanager.inputs.MonitorConfigArgs;
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 profile = new Profile("profile", ProfileArgs.builder()
            .dnsConfig(DnsConfigArgs.builder()
                .relativeName("parentprofile")
                .ttl(35.0)
                .build())
            .endpoints(            
                EndpointArgs.builder()
                    .endpointStatus("Enabled")
                    .minChildEndpoints(2.0)
                    .minChildEndpointsIPv4(1.0)
                    .minChildEndpointsIPv6(2.0)
                    .name("MyFirstNestedEndpoint")
                    .priority(1.0)
                    .target("firstnestedprofile.tmpreview.watmtest.azure-test.net")
                    .type("Microsoft.Network/trafficManagerProfiles/nestedEndpoints")
                    .weight(1.0)
                    .build(),
                EndpointArgs.builder()
                    .endpointStatus("Enabled")
                    .minChildEndpoints(2.0)
                    .minChildEndpointsIPv4(2.0)
                    .minChildEndpointsIPv6(1.0)
                    .name("MySecondNestedEndpoint")
                    .priority(2.0)
                    .target("secondnestedprofile.tmpreview.watmtest.azure-test.net")
                    .type("Microsoft.Network/trafficManagerProfiles/nestedEndpoints")
                    .weight(1.0)
                    .build())
            .location("global")
            .monitorConfig(MonitorConfigArgs.builder()
                .intervalInSeconds(10.0)
                .path("/testpath.aspx")
                .port(80.0)
                .protocol("HTTP")
                .timeoutInSeconds(5.0)
                .toleratedNumberOfFailures(2.0)
                .build())
            .profileName("parentprofile")
            .profileStatus("Enabled")
            .resourceGroupName("myresourcegroup")
            .trafficRoutingMethod("Priority")
            .build());

    }
}
resources:
  profile:
    type: azure-native:trafficmanager:Profile
    properties:
      dnsConfig:
        relativeName: parentprofile
        ttl: 35
      endpoints:
        - endpointStatus: Enabled
          minChildEndpoints: 2
          minChildEndpointsIPv4: 1
          minChildEndpointsIPv6: 2
          name: MyFirstNestedEndpoint
          priority: 1
          target: firstnestedprofile.tmpreview.watmtest.azure-test.net
          type: Microsoft.Network/trafficManagerProfiles/nestedEndpoints
          weight: 1
        - endpointStatus: Enabled
          minChildEndpoints: 2
          minChildEndpointsIPv4: 2
          minChildEndpointsIPv6: 1
          name: MySecondNestedEndpoint
          priority: 2
          target: secondnestedprofile.tmpreview.watmtest.azure-test.net
          type: Microsoft.Network/trafficManagerProfiles/nestedEndpoints
          weight: 1
      location: global
      monitorConfig:
        intervalInSeconds: 10
        path: /testpath.aspx
        port: 80
        protocol: HTTP
        timeoutInSeconds: 5
        toleratedNumberOfFailures: 2
      profileName: parentprofile
      profileStatus: Enabled
      resourceGroupName: myresourcegroup
      trafficRoutingMethod: Priority

Nested endpoints reference other Traffic Manager profiles by their FQDN. The minChildEndpoints property controls when the parent profile considers a nested endpoint healthy: it requires at least this many child endpoints to be available. The minChildEndpointsIPv4 and minChildEndpointsIPv6 properties let you enforce separate thresholds for IPv4 and IPv6 connectivity. Priority and weight control how the parent profile distributes traffic across nested profiles.

Beyond these examples

These snippets focus on specific profile-level features: DNS configuration and routing methods, endpoint types and health monitoring, and nested profiles and custom headers. They’re intentionally minimal rather than full traffic management solutions.

The examples may reference pre-existing infrastructure such as Azure resource groups and external domains or nested Traffic Manager profiles for endpoint targets. They focus on configuring the profile rather than provisioning the surrounding infrastructure.

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

  • MultiValue routing with maxReturn limits
  • Traffic View analytics (trafficViewEnrollmentStatus)
  • Endpoint record type restrictions (allowedEndpointRecordTypes)
  • Geographic and subnet routing methods

These omissions are intentional: the goal is to illustrate how each profile feature is wired, not provide drop-in traffic management modules. See the Traffic Manager Profile resource reference for all available configuration options.

Let's configure Azure Traffic Manager Profiles

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

Try Pulumi Cloud for FREE

Frequently Asked Questions

Configuration & Setup
What region should I use for a Traffic Manager profile?
Traffic Manager profiles must use location: "global". This is an immutable property and all examples in the schema use this value.
What traffic routing methods are available?
Traffic Manager supports Performance, Priority, MultiValue, Weighted, Geographic, and Subnet routing methods. The trafficRoutingMethod property determines how traffic is distributed across endpoints.
What's the `maxReturn` property used for?
maxReturn specifies the maximum number of endpoints returned for MultiValue routing type only. It’s not applicable to other routing methods.
Endpoints & Routing
Can I mix inline endpoints with standalone Endpoint resources?
No, mixing inline endpoints (defined in the Profile resource) with standalone Endpoint resources will cause conflicts and lead to resource deletion. Choose one approach and stick with it.
Can I create a Traffic Manager profile without any endpoints?
Yes, you can create a profile with just dnsConfig, monitorConfig, and trafficRoutingMethod, then add endpoints later.
How do I configure nested Traffic Manager profiles?
Use endpoint type Microsoft.Network/trafficManagerProfiles/nestedEndpoints and configure minChildEndpoints, minChildEndpointsIPv4, and minChildEndpointsIPv6 to control when the nested profile is considered healthy.
How do I use domain names instead of IP addresses for endpoints?
Set allowedEndpointRecordTypes to include DomainName to enable aliasing with domain names like foobar.contoso.com.
Monitoring & Health Checks
How do I configure endpoint health monitoring?
Use monitorConfig to set the health check path, port, protocol, check interval (intervalInSeconds), timeout (timeoutInSeconds), and failure tolerance (toleratedNumberOfFailures).
How do custom headers work with health checks?
You can set custom headers at the profile level (applies to all endpoints) or at the endpoint level. Endpoint-level headers override profile-level headers with the same name.
What status code ranges can I configure for health checks?
Use expectedStatusCodeRanges in monitorConfig to define acceptable HTTP status code ranges (e.g., 200-205, 400-410) for health checks.
Cost & Features
Does enabling Traffic View cost extra?
Yes, enabling Traffic View by setting trafficViewEnrollmentStatus to Enabled will increase the cost of your Traffic Manager profile.

Using a different cloud?

Explore networking guides for other cloud providers: