Configure Azure Peering Connections

The azure-native:peering:Peering resource, part of the Pulumi Azure Native provider, defines a peering relationship with Microsoft’s network edge: the connection type (direct or exchange), BGP sessions, and physical facility locations. This guide focuses on three capabilities: direct peering to Microsoft Edge, Azure Route Server connectivity, and Internet Exchange peering.

Peerings require pre-registered PeerAsn resources that identify your autonomous system to Microsoft, plus physical connectivity at colocation or Internet Exchange facilities. The examples are intentionally small. Combine them with your own PeerAsn registrations and facility arrangements.

Establish direct BGP connections to Microsoft Edge

Organizations connecting their networks directly to Microsoft’s edge infrastructure use direct peering to establish BGP sessions at physical colocation facilities, providing low-latency paths for Microsoft-destined traffic.

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

const peering = new azure_native.peering.Peering("peering", {
    direct: {
        connections: [
            {
                bandwidthInMbps: 10000,
                bgpSession: {
                    maxPrefixesAdvertisedV4: 1000,
                    maxPrefixesAdvertisedV6: 100,
                    md5AuthenticationKey: "test-md5-auth-key",
                    sessionPrefixV4: "192.168.0.0/31",
                    sessionPrefixV6: "fd00::0/127",
                },
                connectionIdentifier: "5F4CB5C7-6B43-4444-9338-9ABC72606C16",
                peeringDBFacilityId: 99999,
                sessionAddressProvider: azure_native.peering.SessionAddressProvider.Peer,
                useForPeeringService: false,
            },
            {
                bandwidthInMbps: 10000,
                connectionIdentifier: "8AB00818-D533-4504-A25A-03A17F61201C",
                peeringDBFacilityId: 99999,
                sessionAddressProvider: azure_native.peering.SessionAddressProvider.Microsoft,
                useForPeeringService: true,
            },
        ],
        directPeeringType: azure_native.peering.DirectPeeringType.Edge,
        peerAsn: {
            id: "/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1",
        },
    },
    kind: azure_native.peering.Kind.Direct,
    location: "eastus",
    peeringLocation: "peeringLocation0",
    peeringName: "peeringName",
    resourceGroupName: "rgName",
    sku: {
        name: "Basic_Direct_Free",
    },
});
import pulumi
import pulumi_azure_native as azure_native

peering = azure_native.peering.Peering("peering",
    direct={
        "connections": [
            {
                "bandwidth_in_mbps": 10000,
                "bgp_session": {
                    "max_prefixes_advertised_v4": 1000,
                    "max_prefixes_advertised_v6": 100,
                    "md5_authentication_key": "test-md5-auth-key",
                    "session_prefix_v4": "192.168.0.0/31",
                    "session_prefix_v6": "fd00::0/127",
                },
                "connection_identifier": "5F4CB5C7-6B43-4444-9338-9ABC72606C16",
                "peering_db_facility_id": 99999,
                "session_address_provider": azure_native.peering.SessionAddressProvider.PEER,
                "use_for_peering_service": False,
            },
            {
                "bandwidth_in_mbps": 10000,
                "connection_identifier": "8AB00818-D533-4504-A25A-03A17F61201C",
                "peering_db_facility_id": 99999,
                "session_address_provider": azure_native.peering.SessionAddressProvider.MICROSOFT,
                "use_for_peering_service": True,
            },
        ],
        "direct_peering_type": azure_native.peering.DirectPeeringType.EDGE,
        "peer_asn": {
            "id": "/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1",
        },
    },
    kind=azure_native.peering.Kind.DIRECT,
    location="eastus",
    peering_location="peeringLocation0",
    peering_name="peeringName",
    resource_group_name="rgName",
    sku={
        "name": "Basic_Direct_Free",
    })
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := peering.NewPeering(ctx, "peering", &peering.PeeringArgs{
			Direct: &peering.PeeringPropertiesDirectArgs{
				Connections: peering.DirectConnectionArray{
					&peering.DirectConnectionArgs{
						BandwidthInMbps: pulumi.Int(10000),
						BgpSession: &peering.BgpSessionArgs{
							MaxPrefixesAdvertisedV4: pulumi.Int(1000),
							MaxPrefixesAdvertisedV6: pulumi.Int(100),
							Md5AuthenticationKey:    pulumi.String("test-md5-auth-key"),
							SessionPrefixV4:         pulumi.String("192.168.0.0/31"),
							SessionPrefixV6:         pulumi.String("fd00::0/127"),
						},
						ConnectionIdentifier:   pulumi.String("5F4CB5C7-6B43-4444-9338-9ABC72606C16"),
						PeeringDBFacilityId:    pulumi.Int(99999),
						SessionAddressProvider: pulumi.String(peering.SessionAddressProviderPeer),
						UseForPeeringService:   pulumi.Bool(false),
					},
					&peering.DirectConnectionArgs{
						BandwidthInMbps:        pulumi.Int(10000),
						ConnectionIdentifier:   pulumi.String("8AB00818-D533-4504-A25A-03A17F61201C"),
						PeeringDBFacilityId:    pulumi.Int(99999),
						SessionAddressProvider: pulumi.String(peering.SessionAddressProviderMicrosoft),
						UseForPeeringService:   pulumi.Bool(true),
					},
				},
				DirectPeeringType: pulumi.String(peering.DirectPeeringTypeEdge),
				PeerAsn: &peering.SubResourceArgs{
					Id: pulumi.String("/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1"),
				},
			},
			Kind:              pulumi.String(peering.KindDirect),
			Location:          pulumi.String("eastus"),
			PeeringLocation:   pulumi.String("peeringLocation0"),
			PeeringName:       pulumi.String("peeringName"),
			ResourceGroupName: pulumi.String("rgName"),
			Sku: &peering.PeeringSkuArgs{
				Name: pulumi.String("Basic_Direct_Free"),
			},
		})
		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 peering = new AzureNative.Peering.Peering("peering", new()
    {
        Direct = new AzureNative.Peering.Inputs.PeeringPropertiesDirectArgs
        {
            Connections = new[]
            {
                new AzureNative.Peering.Inputs.DirectConnectionArgs
                {
                    BandwidthInMbps = 10000,
                    BgpSession = new AzureNative.Peering.Inputs.BgpSessionArgs
                    {
                        MaxPrefixesAdvertisedV4 = 1000,
                        MaxPrefixesAdvertisedV6 = 100,
                        Md5AuthenticationKey = "test-md5-auth-key",
                        SessionPrefixV4 = "192.168.0.0/31",
                        SessionPrefixV6 = "fd00::0/127",
                    },
                    ConnectionIdentifier = "5F4CB5C7-6B43-4444-9338-9ABC72606C16",
                    PeeringDBFacilityId = 99999,
                    SessionAddressProvider = AzureNative.Peering.SessionAddressProvider.Peer,
                    UseForPeeringService = false,
                },
                new AzureNative.Peering.Inputs.DirectConnectionArgs
                {
                    BandwidthInMbps = 10000,
                    ConnectionIdentifier = "8AB00818-D533-4504-A25A-03A17F61201C",
                    PeeringDBFacilityId = 99999,
                    SessionAddressProvider = AzureNative.Peering.SessionAddressProvider.Microsoft,
                    UseForPeeringService = true,
                },
            },
            DirectPeeringType = AzureNative.Peering.DirectPeeringType.Edge,
            PeerAsn = new AzureNative.Peering.Inputs.SubResourceArgs
            {
                Id = "/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1",
            },
        },
        Kind = AzureNative.Peering.Kind.Direct,
        Location = "eastus",
        PeeringLocation = "peeringLocation0",
        PeeringName = "peeringName",
        ResourceGroupName = "rgName",
        Sku = new AzureNative.Peering.Inputs.PeeringSkuArgs
        {
            Name = "Basic_Direct_Free",
        },
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.peering.Peering;
import com.pulumi.azurenative.peering.PeeringArgs;
import com.pulumi.azurenative.peering.inputs.PeeringPropertiesDirectArgs;
import com.pulumi.azurenative.peering.inputs.SubResourceArgs;
import com.pulumi.azurenative.peering.inputs.PeeringSkuArgs;
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 peering = new Peering("peering", PeeringArgs.builder()
            .direct(PeeringPropertiesDirectArgs.builder()
                .connections(                
                    DirectConnectionArgs.builder()
                        .bandwidthInMbps(10000)
                        .bgpSession(BgpSessionArgs.builder()
                            .maxPrefixesAdvertisedV4(1000)
                            .maxPrefixesAdvertisedV6(100)
                            .md5AuthenticationKey("test-md5-auth-key")
                            .sessionPrefixV4("192.168.0.0/31")
                            .sessionPrefixV6("fd00::0/127")
                            .build())
                        .connectionIdentifier("5F4CB5C7-6B43-4444-9338-9ABC72606C16")
                        .peeringDBFacilityId(99999)
                        .sessionAddressProvider("Peer")
                        .useForPeeringService(false)
                        .build(),
                    DirectConnectionArgs.builder()
                        .bandwidthInMbps(10000)
                        .connectionIdentifier("8AB00818-D533-4504-A25A-03A17F61201C")
                        .peeringDBFacilityId(99999)
                        .sessionAddressProvider("Microsoft")
                        .useForPeeringService(true)
                        .build())
                .directPeeringType("Edge")
                .peerAsn(SubResourceArgs.builder()
                    .id("/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1")
                    .build())
                .build())
            .kind("Direct")
            .location("eastus")
            .peeringLocation("peeringLocation0")
            .peeringName("peeringName")
            .resourceGroupName("rgName")
            .sku(PeeringSkuArgs.builder()
                .name("Basic_Direct_Free")
                .build())
            .build());

    }
}
resources:
  peering:
    type: azure-native:peering:Peering
    properties:
      direct:
        connections:
          - bandwidthInMbps: 10000
            bgpSession:
              maxPrefixesAdvertisedV4: 1000
              maxPrefixesAdvertisedV6: 100
              md5AuthenticationKey: test-md5-auth-key
              sessionPrefixV4: 192.168.0.0/31
              sessionPrefixV6: fd00::0/127
            connectionIdentifier: 5F4CB5C7-6B43-4444-9338-9ABC72606C16
            peeringDBFacilityId: 99999
            sessionAddressProvider: Peer
            useForPeeringService: false
          - bandwidthInMbps: 10000
            connectionIdentifier: 8AB00818-D533-4504-A25A-03A17F61201C
            peeringDBFacilityId: 99999
            sessionAddressProvider: Microsoft
            useForPeeringService: true
        directPeeringType: Edge
        peerAsn:
          id: /subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1
      kind: Direct
      location: eastus
      peeringLocation: peeringLocation0
      peeringName: peeringName
      resourceGroupName: rgName
      sku:
        name: Basic_Direct_Free

The direct property defines the peering type and connections array. Each connection specifies bandwidthInMbps (the physical port capacity), a bgpSession block with IPv4/IPv6 prefixes and prefix limits, and a connectionIdentifier matching your physical port assignment. The sessionAddressProvider determines who allocates BGP session IPs: set to “Peer” when you provide them, or “Microsoft” when Microsoft assigns them. The peerAsn references your registered ASN, and directPeeringType set to “Edge” indicates standard edge peering.

Connect to Azure Route Server via Internet Exchange

Azure Route Server (IxRs) enables dynamic routing between your network and Azure virtual networks through an Internet Exchange point, simplifying hybrid connectivity without dedicated circuits.

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

const peering = new azure_native.peering.Peering("peering", {
    direct: {
        connections: [{
            bandwidthInMbps: 10000,
            bgpSession: {
                maxPrefixesAdvertisedV4: 1000,
                maxPrefixesAdvertisedV6: 100,
                microsoftSessionIPv4Address: "192.168.0.123",
                peerSessionIPv4Address: "192.168.0.234",
                sessionPrefixV4: "192.168.0.0/24",
            },
            connectionIdentifier: "5F4CB5C7-6B43-4444-9338-9ABC72606C16",
            peeringDBFacilityId: 99999,
            sessionAddressProvider: azure_native.peering.SessionAddressProvider.Peer,
            useForPeeringService: true,
        }],
        directPeeringType: azure_native.peering.DirectPeeringType.IxRs,
        peerAsn: {
            id: "/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1",
        },
    },
    kind: azure_native.peering.Kind.Direct,
    location: "eastus",
    peeringLocation: "peeringLocation0",
    peeringName: "peeringName",
    resourceGroupName: "rgName",
    sku: {
        name: "Premium_Direct_Free",
    },
});
import pulumi
import pulumi_azure_native as azure_native

peering = azure_native.peering.Peering("peering",
    direct={
        "connections": [{
            "bandwidth_in_mbps": 10000,
            "bgp_session": {
                "max_prefixes_advertised_v4": 1000,
                "max_prefixes_advertised_v6": 100,
                "microsoft_session_i_pv4_address": "192.168.0.123",
                "peer_session_i_pv4_address": "192.168.0.234",
                "session_prefix_v4": "192.168.0.0/24",
            },
            "connection_identifier": "5F4CB5C7-6B43-4444-9338-9ABC72606C16",
            "peering_db_facility_id": 99999,
            "session_address_provider": azure_native.peering.SessionAddressProvider.PEER,
            "use_for_peering_service": True,
        }],
        "direct_peering_type": azure_native.peering.DirectPeeringType.IX_RS,
        "peer_asn": {
            "id": "/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1",
        },
    },
    kind=azure_native.peering.Kind.DIRECT,
    location="eastus",
    peering_location="peeringLocation0",
    peering_name="peeringName",
    resource_group_name="rgName",
    sku={
        "name": "Premium_Direct_Free",
    })
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := peering.NewPeering(ctx, "peering", &peering.PeeringArgs{
			Direct: &peering.PeeringPropertiesDirectArgs{
				Connections: peering.DirectConnectionArray{
					&peering.DirectConnectionArgs{
						BandwidthInMbps: pulumi.Int(10000),
						BgpSession: &peering.BgpSessionArgs{
							MaxPrefixesAdvertisedV4:     pulumi.Int(1000),
							MaxPrefixesAdvertisedV6:     pulumi.Int(100),
							MicrosoftSessionIPv4Address: pulumi.String("192.168.0.123"),
							PeerSessionIPv4Address:      pulumi.String("192.168.0.234"),
							SessionPrefixV4:             pulumi.String("192.168.0.0/24"),
						},
						ConnectionIdentifier:   pulumi.String("5F4CB5C7-6B43-4444-9338-9ABC72606C16"),
						PeeringDBFacilityId:    pulumi.Int(99999),
						SessionAddressProvider: pulumi.String(peering.SessionAddressProviderPeer),
						UseForPeeringService:   pulumi.Bool(true),
					},
				},
				DirectPeeringType: pulumi.String(peering.DirectPeeringTypeIxRs),
				PeerAsn: &peering.SubResourceArgs{
					Id: pulumi.String("/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1"),
				},
			},
			Kind:              pulumi.String(peering.KindDirect),
			Location:          pulumi.String("eastus"),
			PeeringLocation:   pulumi.String("peeringLocation0"),
			PeeringName:       pulumi.String("peeringName"),
			ResourceGroupName: pulumi.String("rgName"),
			Sku: &peering.PeeringSkuArgs{
				Name: pulumi.String("Premium_Direct_Free"),
			},
		})
		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 peering = new AzureNative.Peering.Peering("peering", new()
    {
        Direct = new AzureNative.Peering.Inputs.PeeringPropertiesDirectArgs
        {
            Connections = new[]
            {
                new AzureNative.Peering.Inputs.DirectConnectionArgs
                {
                    BandwidthInMbps = 10000,
                    BgpSession = new AzureNative.Peering.Inputs.BgpSessionArgs
                    {
                        MaxPrefixesAdvertisedV4 = 1000,
                        MaxPrefixesAdvertisedV6 = 100,
                        MicrosoftSessionIPv4Address = "192.168.0.123",
                        PeerSessionIPv4Address = "192.168.0.234",
                        SessionPrefixV4 = "192.168.0.0/24",
                    },
                    ConnectionIdentifier = "5F4CB5C7-6B43-4444-9338-9ABC72606C16",
                    PeeringDBFacilityId = 99999,
                    SessionAddressProvider = AzureNative.Peering.SessionAddressProvider.Peer,
                    UseForPeeringService = true,
                },
            },
            DirectPeeringType = AzureNative.Peering.DirectPeeringType.IxRs,
            PeerAsn = new AzureNative.Peering.Inputs.SubResourceArgs
            {
                Id = "/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1",
            },
        },
        Kind = AzureNative.Peering.Kind.Direct,
        Location = "eastus",
        PeeringLocation = "peeringLocation0",
        PeeringName = "peeringName",
        ResourceGroupName = "rgName",
        Sku = new AzureNative.Peering.Inputs.PeeringSkuArgs
        {
            Name = "Premium_Direct_Free",
        },
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.peering.Peering;
import com.pulumi.azurenative.peering.PeeringArgs;
import com.pulumi.azurenative.peering.inputs.PeeringPropertiesDirectArgs;
import com.pulumi.azurenative.peering.inputs.SubResourceArgs;
import com.pulumi.azurenative.peering.inputs.PeeringSkuArgs;
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 peering = new Peering("peering", PeeringArgs.builder()
            .direct(PeeringPropertiesDirectArgs.builder()
                .connections(DirectConnectionArgs.builder()
                    .bandwidthInMbps(10000)
                    .bgpSession(BgpSessionArgs.builder()
                        .maxPrefixesAdvertisedV4(1000)
                        .maxPrefixesAdvertisedV6(100)
                        .microsoftSessionIPv4Address("192.168.0.123")
                        .peerSessionIPv4Address("192.168.0.234")
                        .sessionPrefixV4("192.168.0.0/24")
                        .build())
                    .connectionIdentifier("5F4CB5C7-6B43-4444-9338-9ABC72606C16")
                    .peeringDBFacilityId(99999)
                    .sessionAddressProvider("Peer")
                    .useForPeeringService(true)
                    .build())
                .directPeeringType("IxRs")
                .peerAsn(SubResourceArgs.builder()
                    .id("/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1")
                    .build())
                .build())
            .kind("Direct")
            .location("eastus")
            .peeringLocation("peeringLocation0")
            .peeringName("peeringName")
            .resourceGroupName("rgName")
            .sku(PeeringSkuArgs.builder()
                .name("Premium_Direct_Free")
                .build())
            .build());

    }
}
resources:
  peering:
    type: azure-native:peering:Peering
    properties:
      direct:
        connections:
          - bandwidthInMbps: 10000
            bgpSession:
              maxPrefixesAdvertisedV4: 1000
              maxPrefixesAdvertisedV6: 100
              microsoftSessionIPv4Address: 192.168.0.123
              peerSessionIPv4Address: 192.168.0.234
              sessionPrefixV4: 192.168.0.0/24
            connectionIdentifier: 5F4CB5C7-6B43-4444-9338-9ABC72606C16
            peeringDBFacilityId: 99999
            sessionAddressProvider: Peer
            useForPeeringService: true
        directPeeringType: IxRs
        peerAsn:
          id: /subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1
      kind: Direct
      location: eastus
      peeringLocation: peeringLocation0
      peeringName: peeringName
      resourceGroupName: rgName
      sku:
        name: Premium_Direct_Free

Setting directPeeringType to “IxRs” configures the peering for Azure Route Server integration. The bgpSession includes microsoftSessionIPv4Address and peerSessionIPv4Address, which define the BGP neighbor relationship. When useForPeeringService is true, the connection can be used for Azure Peering Service, which optimizes routing to Microsoft services. The Premium_Direct_Free SKU is required for Route Server peering.

Peer at an Internet Exchange point

Internet Exchange peering connects networks through shared switching fabric at IX facilities, enabling efficient traffic exchange with multiple networks including Microsoft services.

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

const peering = new azure_native.peering.Peering("peering", {
    exchange: {
        connections: [
            {
                bgpSession: {
                    maxPrefixesAdvertisedV4: 1000,
                    maxPrefixesAdvertisedV6: 100,
                    md5AuthenticationKey: "test-md5-auth-key",
                    peerSessionIPv4Address: "192.168.2.1",
                    peerSessionIPv6Address: "fd00::1",
                },
                connectionIdentifier: "CE495334-0E94-4E51-8164-8116D6CD284D",
                peeringDBFacilityId: 99999,
            },
            {
                bgpSession: {
                    maxPrefixesAdvertisedV4: 1000,
                    maxPrefixesAdvertisedV6: 100,
                    md5AuthenticationKey: "test-md5-auth-key",
                    peerSessionIPv4Address: "192.168.2.2",
                    peerSessionIPv6Address: "fd00::2",
                },
                connectionIdentifier: "CDD8E673-CB07-47E6-84DE-3739F778762B",
                peeringDBFacilityId: 99999,
            },
        ],
        peerAsn: {
            id: "/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1",
        },
    },
    kind: azure_native.peering.Kind.Exchange,
    location: "eastus",
    peeringLocation: "peeringLocation0",
    peeringName: "peeringName",
    resourceGroupName: "rgName",
    sku: {
        name: "Basic_Exchange_Free",
    },
});
import pulumi
import pulumi_azure_native as azure_native

peering = azure_native.peering.Peering("peering",
    exchange={
        "connections": [
            {
                "bgp_session": {
                    "max_prefixes_advertised_v4": 1000,
                    "max_prefixes_advertised_v6": 100,
                    "md5_authentication_key": "test-md5-auth-key",
                    "peer_session_i_pv4_address": "192.168.2.1",
                    "peer_session_i_pv6_address": "fd00::1",
                },
                "connection_identifier": "CE495334-0E94-4E51-8164-8116D6CD284D",
                "peering_db_facility_id": 99999,
            },
            {
                "bgp_session": {
                    "max_prefixes_advertised_v4": 1000,
                    "max_prefixes_advertised_v6": 100,
                    "md5_authentication_key": "test-md5-auth-key",
                    "peer_session_i_pv4_address": "192.168.2.2",
                    "peer_session_i_pv6_address": "fd00::2",
                },
                "connection_identifier": "CDD8E673-CB07-47E6-84DE-3739F778762B",
                "peering_db_facility_id": 99999,
            },
        ],
        "peer_asn": {
            "id": "/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1",
        },
    },
    kind=azure_native.peering.Kind.EXCHANGE,
    location="eastus",
    peering_location="peeringLocation0",
    peering_name="peeringName",
    resource_group_name="rgName",
    sku={
        "name": "Basic_Exchange_Free",
    })
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := peering.NewPeering(ctx, "peering", &peering.PeeringArgs{
			Exchange: &peering.PeeringPropertiesExchangeArgs{
				Connections: peering.ExchangeConnectionArray{
					&peering.ExchangeConnectionArgs{
						BgpSession: &peering.BgpSessionArgs{
							MaxPrefixesAdvertisedV4: pulumi.Int(1000),
							MaxPrefixesAdvertisedV6: pulumi.Int(100),
							Md5AuthenticationKey:    pulumi.String("test-md5-auth-key"),
							PeerSessionIPv4Address:  pulumi.String("192.168.2.1"),
							PeerSessionIPv6Address:  pulumi.String("fd00::1"),
						},
						ConnectionIdentifier: pulumi.String("CE495334-0E94-4E51-8164-8116D6CD284D"),
						PeeringDBFacilityId:  pulumi.Int(99999),
					},
					&peering.ExchangeConnectionArgs{
						BgpSession: &peering.BgpSessionArgs{
							MaxPrefixesAdvertisedV4: pulumi.Int(1000),
							MaxPrefixesAdvertisedV6: pulumi.Int(100),
							Md5AuthenticationKey:    pulumi.String("test-md5-auth-key"),
							PeerSessionIPv4Address:  pulumi.String("192.168.2.2"),
							PeerSessionIPv6Address:  pulumi.String("fd00::2"),
						},
						ConnectionIdentifier: pulumi.String("CDD8E673-CB07-47E6-84DE-3739F778762B"),
						PeeringDBFacilityId:  pulumi.Int(99999),
					},
				},
				PeerAsn: &peering.SubResourceArgs{
					Id: pulumi.String("/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1"),
				},
			},
			Kind:              pulumi.String(peering.KindExchange),
			Location:          pulumi.String("eastus"),
			PeeringLocation:   pulumi.String("peeringLocation0"),
			PeeringName:       pulumi.String("peeringName"),
			ResourceGroupName: pulumi.String("rgName"),
			Sku: &peering.PeeringSkuArgs{
				Name: pulumi.String("Basic_Exchange_Free"),
			},
		})
		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 peering = new AzureNative.Peering.Peering("peering", new()
    {
        Exchange = new AzureNative.Peering.Inputs.PeeringPropertiesExchangeArgs
        {
            Connections = new[]
            {
                new AzureNative.Peering.Inputs.ExchangeConnectionArgs
                {
                    BgpSession = new AzureNative.Peering.Inputs.BgpSessionArgs
                    {
                        MaxPrefixesAdvertisedV4 = 1000,
                        MaxPrefixesAdvertisedV6 = 100,
                        Md5AuthenticationKey = "test-md5-auth-key",
                        PeerSessionIPv4Address = "192.168.2.1",
                        PeerSessionIPv6Address = "fd00::1",
                    },
                    ConnectionIdentifier = "CE495334-0E94-4E51-8164-8116D6CD284D",
                    PeeringDBFacilityId = 99999,
                },
                new AzureNative.Peering.Inputs.ExchangeConnectionArgs
                {
                    BgpSession = new AzureNative.Peering.Inputs.BgpSessionArgs
                    {
                        MaxPrefixesAdvertisedV4 = 1000,
                        MaxPrefixesAdvertisedV6 = 100,
                        Md5AuthenticationKey = "test-md5-auth-key",
                        PeerSessionIPv4Address = "192.168.2.2",
                        PeerSessionIPv6Address = "fd00::2",
                    },
                    ConnectionIdentifier = "CDD8E673-CB07-47E6-84DE-3739F778762B",
                    PeeringDBFacilityId = 99999,
                },
            },
            PeerAsn = new AzureNative.Peering.Inputs.SubResourceArgs
            {
                Id = "/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1",
            },
        },
        Kind = AzureNative.Peering.Kind.Exchange,
        Location = "eastus",
        PeeringLocation = "peeringLocation0",
        PeeringName = "peeringName",
        ResourceGroupName = "rgName",
        Sku = new AzureNative.Peering.Inputs.PeeringSkuArgs
        {
            Name = "Basic_Exchange_Free",
        },
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.peering.Peering;
import com.pulumi.azurenative.peering.PeeringArgs;
import com.pulumi.azurenative.peering.inputs.PeeringPropertiesExchangeArgs;
import com.pulumi.azurenative.peering.inputs.SubResourceArgs;
import com.pulumi.azurenative.peering.inputs.PeeringSkuArgs;
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 peering = new Peering("peering", PeeringArgs.builder()
            .exchange(PeeringPropertiesExchangeArgs.builder()
                .connections(                
                    ExchangeConnectionArgs.builder()
                        .bgpSession(BgpSessionArgs.builder()
                            .maxPrefixesAdvertisedV4(1000)
                            .maxPrefixesAdvertisedV6(100)
                            .md5AuthenticationKey("test-md5-auth-key")
                            .peerSessionIPv4Address("192.168.2.1")
                            .peerSessionIPv6Address("fd00::1")
                            .build())
                        .connectionIdentifier("CE495334-0E94-4E51-8164-8116D6CD284D")
                        .peeringDBFacilityId(99999)
                        .build(),
                    ExchangeConnectionArgs.builder()
                        .bgpSession(BgpSessionArgs.builder()
                            .maxPrefixesAdvertisedV4(1000)
                            .maxPrefixesAdvertisedV6(100)
                            .md5AuthenticationKey("test-md5-auth-key")
                            .peerSessionIPv4Address("192.168.2.2")
                            .peerSessionIPv6Address("fd00::2")
                            .build())
                        .connectionIdentifier("CDD8E673-CB07-47E6-84DE-3739F778762B")
                        .peeringDBFacilityId(99999)
                        .build())
                .peerAsn(SubResourceArgs.builder()
                    .id("/subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1")
                    .build())
                .build())
            .kind("Exchange")
            .location("eastus")
            .peeringLocation("peeringLocation0")
            .peeringName("peeringName")
            .resourceGroupName("rgName")
            .sku(PeeringSkuArgs.builder()
                .name("Basic_Exchange_Free")
                .build())
            .build());

    }
}
resources:
  peering:
    type: azure-native:peering:Peering
    properties:
      exchange:
        connections:
          - bgpSession:
              maxPrefixesAdvertisedV4: 1000
              maxPrefixesAdvertisedV6: 100
              md5AuthenticationKey: test-md5-auth-key
              peerSessionIPv4Address: 192.168.2.1
              peerSessionIPv6Address: fd00::1
            connectionIdentifier: CE495334-0E94-4E51-8164-8116D6CD284D
            peeringDBFacilityId: 99999
          - bgpSession:
              maxPrefixesAdvertisedV4: 1000
              maxPrefixesAdvertisedV6: 100
              md5AuthenticationKey: test-md5-auth-key
              peerSessionIPv4Address: 192.168.2.2
              peerSessionIPv6Address: fd00::2
            connectionIdentifier: CDD8E673-CB07-47E6-84DE-3739F778762B
            peeringDBFacilityId: 99999
        peerAsn:
          id: /subscriptions/subId/providers/Microsoft.Peering/peerAsns/myAsn1
      kind: Exchange
      location: eastus
      peeringLocation: peeringLocation0
      peeringName: peeringName
      resourceGroupName: rgName
      sku:
        name: Basic_Exchange_Free

The exchange property replaces direct for IX-based peering. Each connection in the connections array specifies peerSessionIPv4Address and peerSessionIPv6Address (assigned by the IX operator), a connectionIdentifier (your port ID at the IX), and peeringDBFacilityId (the facility’s PeeringDB identifier). The bgpSession block sets prefix advertisement limits and optional MD5 authentication. The Basic_Exchange_Free SKU applies to IX peering.

Beyond these examples

These snippets focus on specific peering features: direct and exchange peering types, BGP session configuration (IPv4/IPv6, MD5 auth, prefix limits), and Azure Route Server integration. They’re intentionally minimal rather than full network interconnection designs.

The examples reference pre-existing infrastructure such as PeerAsn resources (registered ASN with Microsoft), physical cross-connects or IX port assignments, and PeeringDB facility memberships. They focus on configuring the peering relationship rather than provisioning the underlying network infrastructure.

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

  • Resource tagging (tags property)
  • Multiple peering locations in one resource
  • Peering Service enablement details
  • Connection state monitoring and troubleshooting

These omissions are intentional: the goal is to illustrate how each peering type is wired, not provide drop-in network interconnection modules. See the Peering resource reference for all available configuration options.

Let's configure Azure Peering Connections

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

Try Pulumi Cloud for FREE

Frequently Asked Questions

Peering Types & Configuration
What's the difference between Direct and Exchange peering?
Direct peering connects directly to Microsoft’s network edge, while Exchange peering connects through an internet exchange point. Use kind: Direct for direct connections and kind: Exchange for exchange point connections.
What's the difference between Edge and IxRs direct peering types?
Edge is standard direct peering, while IxRs (Internet Exchange Route Server) is for exchange route server scenarios. IxRs requires the Premium SKU (Premium_Direct_Free), whereas Edge uses the Basic SKU (Basic_Direct_Free).
What SKUs are available for peering?
Available SKUs include Basic_Direct_Free for Edge direct peering, Premium_Direct_Free for IxRs direct peering, and Basic_Exchange_Free for exchange peering. The SKU determines both the tier (Basic/Premium) and supported peering kind.
Can I have multiple connections in a single peering resource?
Yes, both direct and exchange peering support multiple connections through the connections array. Examples show configurations with 1-2 connections per peering resource.
Connections & BGP Sessions
When should I use Peer vs Microsoft for sessionAddressProvider?
Use sessionAddressProvider: Peer when you provide the BGP session addresses, or sessionAddressProvider: Microsoft when Microsoft provides them. The first example shows Peer with explicit session prefixes, while the second connection uses Microsoft as the provider.
What BGP session parameters are required?
BGP sessions require maxPrefixesAdvertisedV4 and maxPrefixesAdvertisedV6 for prefix limits. For Peer-provided addresses, specify sessionPrefixV4 and sessionPrefixV6. Optionally include md5AuthenticationKey for authentication and explicit peer/Microsoft session IP addresses.
What does useForPeeringService do?
The useForPeeringService flag indicates whether a connection is used for Azure Peering Service. Set to true to enable Peering Service features, or false for standard peering connections.
Resource Management
What properties can't I change after creating a peering?
The location, peeringName, and resourceGroupName properties are immutable and cannot be changed after creation. You’ll need to recreate the peering resource to modify these values.
How do I access different API versions for this resource?
The default API version is 2022-10-01. To use other versions like 2025-05-01, generate a local SDK package using pulumi package add azure-native peering [ApiVersion].
What's required to reference a peer ASN?
Use the peerAsn property with an id pointing to an existing PeerAsn resource, formatted as /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{asnName}.

Using a different cloud?

Explore networking guides for other cloud providers: