The azure-native:trafficmanager:Profile resource, part of the Pulumi Azure Native provider, defines a Traffic Manager profile that provides DNS-based traffic routing and endpoint health monitoring. This guide focuses on three capabilities: DNS and routing method configuration, external and nested endpoint types, and health monitoring with custom headers.
Traffic Manager profiles require an Azure resource group and reference external services or nested profiles as endpoint targets. 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 relativeName (which becomes part of the FQDN) and ttl for DNS responses. The trafficRoutingMethod determines how Traffic Manager selects endpoints; Performance routes users to the lowest-latency endpoint. The monitorConfig defines health checks: Traffic Manager probes the specified path and port, marking endpoints unhealthy if they fail the configured protocol checks.
Add external endpoints to route traffic
Once the profile exists, you add endpoints that represent the destinations where Traffic Manager directs requests.
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 flows. Each endpoint specifies a target (domain name or IP), endpointLocation for geographic context, and type to indicate whether it’s an external service, Azure endpoint, or nested profile. Traffic Manager only routes to endpoints with endpointStatus set to Enabled. The monitorConfig from the profile applies to all endpoints unless overridden.
Return multiple endpoints with MultiValue routing
Applications needing client-side load balancing can use MultiValue routing to return multiple healthy endpoints in a single DNS response.
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",
maxReturn: 2,
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.MultiValue,
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": "azsmnet6386",
"ttl": 35,
},
location="global",
max_return=2,
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.MULTI_VALUE,
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("azsmnet6386"),
Ttl: pulumi.Float64(35),
},
Location: pulumi.String("global"),
MaxReturn: pulumi.Float64(2),
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.TrafficRoutingMethodMultiValue),
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 = "azsmnet6386",
Ttl = 35,
},
Location = "global",
MaxReturn = 2,
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.MultiValue,
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.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")
.maxReturn(2.0)
.monitorConfig(MonitorConfigArgs.builder()
.path("/testpath.aspx")
.port(80.0)
.protocol("HTTP")
.build())
.profileName("azsmnet6386")
.profileStatus("Enabled")
.resourceGroupName("azuresdkfornetautoresttrafficmanager1421")
.trafficRoutingMethod("MultiValue")
.trafficViewEnrollmentStatus("Disabled")
.build());
}
}
resources:
profile:
type: azure-native:trafficmanager:Profile
properties:
dnsConfig:
relativeName: azsmnet6386
ttl: 35
location: global
maxReturn: 2
monitorConfig:
path: /testpath.aspx
port: 80
protocol: HTTP
profileName: azsmnet6386
profileStatus: Enabled
resourceGroupName: azuresdkfornetautoresttrafficmanager1421
trafficRoutingMethod: MultiValue
trafficViewEnrollmentStatus: Disabled
When trafficRoutingMethod is MultiValue, Traffic Manager returns up to maxReturn healthy endpoints in each DNS query. Clients receive multiple IP addresses and can implement their own failover or load distribution logic. This differs from Performance routing, which returns a single best endpoint.
Add custom headers to health checks
Health monitoring often requires custom headers for authentication or routing through proxies.
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.EndpointPropertiesCustomHeadersArray{
&trafficmanager.EndpointPropertiesCustomHeadersArgs{
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.MonitorConfigCustomHeadersArray{
&trafficmanager.MonitorConfigCustomHeadersArgs{
Name: pulumi.String("header-1"),
Value: pulumi.String("value-1"),
},
&trafficmanager.MonitorConfigCustomHeadersArgs{
Name: pulumi.String("header-2"),
Value: pulumi.String("value-2"),
},
},
ExpectedStatusCodeRanges: trafficmanager.MonitorConfigExpectedStatusCodeRangesArray{
&trafficmanager.MonitorConfigExpectedStatusCodeRangesArgs{
Max: pulumi.Int(205),
Min: pulumi.Int(200),
},
&trafficmanager.MonitorConfigExpectedStatusCodeRangesArgs{
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.EndpointPropertiesCustomHeadersArgs
{
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.MonitorConfigCustomHeadersArgs
{
Name = "header-1",
Value = "value-1",
},
new AzureNative.TrafficManager.Inputs.MonitorConfigCustomHeadersArgs
{
Name = "header-2",
Value = "value-2",
},
},
ExpectedStatusCodeRanges = new[]
{
new AzureNative.TrafficManager.Inputs.MonitorConfigExpectedStatusCodeRangesArgs
{
Max = 205,
Min = 200,
},
new AzureNative.TrafficManager.Inputs.MonitorConfigExpectedStatusCodeRangesArgs
{
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(EndpointPropertiesCustomHeadersArgs.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(
MonitorConfigCustomHeadersArgs.builder()
.name("header-1")
.value("value-1")
.build(),
MonitorConfigCustomHeadersArgs.builder()
.name("header-2")
.value("value-2")
.build())
.expectedStatusCodeRanges(
MonitorConfigExpectedStatusCodeRangesArgs.builder()
.max(205)
.min(200)
.build(),
MonitorConfigExpectedStatusCodeRangesArgs.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
The customHeaders array in monitorConfig adds headers to every health probe. Endpoints can override these with their own customHeaders. The expectedStatusCodeRanges property defines which HTTP status codes indicate healthy endpoints; here, 200-205 and 400-410 are both considered healthy. This flexibility supports scenarios where certain error codes are expected and acceptable.
Build hierarchical routing with nested profiles
Complex deployments nest 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 via their FQDN in the target property. The minChildEndpoints properties control when the parent considers a nested endpoint healthy: it must have at least that many healthy child endpoints. The IPv4 and IPv6 variants let you set different thresholds for each address family. The trafficRoutingMethod of Priority means Traffic Manager uses the lowest-priority healthy endpoint first.
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 services 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:
- Traffic View analytics (trafficViewEnrollmentStatus)
- Endpoint weighting and priority tuning
- Geographic routing method
- Subnet routing method
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 FREEFrequently Asked Questions
Configuration & Setup
location to be set to global. This property is immutable and cannot be changed after creation.maxReturn to specify the maximum number of endpoints returned (e.g., 2).dnsConfig (with relativeName and ttl), monitorConfig (with path, port, and protocol), and trafficRoutingMethod. The location must be set to global.Endpoints Management
type set to Microsoft.Network/trafficManagerProfiles/nestedEndpoints. Configure minChildEndpoints, minChildEndpointsIPv4, and minChildEndpointsIPv6 to control when the nested profile is considered healthy.allowedEndpointRecordTypes to specify allowed types. For example, set it to DomainName to allow domain name endpoints.Monitoring & Health Checks
customHeaders in monitorConfig to apply headers to all endpoints. You can override these at the endpoint level by setting customHeaders on individual endpoints.expectedStatusCodeRanges in monitorConfig with min and max values to define acceptable status code ranges (e.g., 200-205, 400-410).Cost & Features
trafficViewEnrollmentStatus to Enabled will increase the cost of your Traffic Manager profile.