1. Packages
  2. Azure Classic
  3. API Docs
  4. network
  5. BgpConnection

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Manages a Bgp Connection for a Virtual Hub.

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
            {
                Location = "West Europe",
            });
            var exampleVirtualHub = new Azure.Network.VirtualHub("exampleVirtualHub", new Azure.Network.VirtualHubArgs
            {
                ResourceGroupName = exampleResourceGroup.Name,
                Location = exampleResourceGroup.Location,
                Sku = "Standard",
            });
            var examplePublicIp = new Azure.Network.PublicIp("examplePublicIp", new Azure.Network.PublicIpArgs
            {
                Location = exampleResourceGroup.Location,
                ResourceGroupName = exampleResourceGroup.Name,
                AllocationMethod = "Dynamic",
            });
            var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("exampleVirtualNetwork", new Azure.Network.VirtualNetworkArgs
            {
                AddressSpaces = 
                {
                    "10.5.0.0/16",
                },
                Location = exampleResourceGroup.Location,
                ResourceGroupName = exampleResourceGroup.Name,
            });
            var exampleSubnet = new Azure.Network.Subnet("exampleSubnet", new Azure.Network.SubnetArgs
            {
                ResourceGroupName = exampleResourceGroup.Name,
                VirtualNetworkName = exampleVirtualNetwork.Name,
                AddressPrefix = "10.5.1.0/24",
            });
            var exampleVirtualHubIp = new Azure.Network.VirtualHubIp("exampleVirtualHubIp", new Azure.Network.VirtualHubIpArgs
            {
                VirtualHubId = exampleVirtualHub.Id,
                PrivateIpAddress = "10.5.1.18",
                PrivateIpAllocationMethod = "Static",
                PublicIpAddressId = examplePublicIp.Id,
                SubnetId = exampleSubnet.Id,
            });
            var exampleBgpConnection = new Azure.Network.BgpConnection("exampleBgpConnection", new Azure.Network.BgpConnectionArgs
            {
                VirtualHubId = exampleVirtualHub.Id,
                PeerAsn = 65514,
                PeerIp = "169.254.21.5",
            }, new CustomResourceOptions
            {
                DependsOn = 
                {
                    exampleVirtualHubIp,
                },
            });
        }
    
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/network"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleVirtualHub, err := network.NewVirtualHub(ctx, "exampleVirtualHub", &network.VirtualHubArgs{
    			ResourceGroupName: exampleResourceGroup.Name,
    			Location:          exampleResourceGroup.Location,
    			Sku:               pulumi.String("Standard"),
    		})
    		if err != nil {
    			return err
    		}
    		examplePublicIp, err := network.NewPublicIp(ctx, "examplePublicIp", &network.PublicIpArgs{
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    			AllocationMethod:  pulumi.String("Dynamic"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "exampleVirtualNetwork", &network.VirtualNetworkArgs{
    			AddressSpaces: pulumi.StringArray{
    				pulumi.String("10.5.0.0/16"),
    			},
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    		})
    		if err != nil {
    			return err
    		}
    		exampleSubnet, err := network.NewSubnet(ctx, "exampleSubnet", &network.SubnetArgs{
    			ResourceGroupName:  exampleResourceGroup.Name,
    			VirtualNetworkName: exampleVirtualNetwork.Name,
    			AddressPrefix:      pulumi.String("10.5.1.0/24"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleVirtualHubIp, err := network.NewVirtualHubIp(ctx, "exampleVirtualHubIp", &network.VirtualHubIpArgs{
    			VirtualHubId:              exampleVirtualHub.ID(),
    			PrivateIpAddress:          pulumi.String("10.5.1.18"),
    			PrivateIpAllocationMethod: pulumi.String("Static"),
    			PublicIpAddressId:         examplePublicIp.ID(),
    			SubnetId:                  exampleSubnet.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = network.NewBgpConnection(ctx, "exampleBgpConnection", &network.BgpConnectionArgs{
    			VirtualHubId: exampleVirtualHub.ID(),
    			PeerAsn:      pulumi.Int(65514),
    			PeerIp:       pulumi.String("169.254.21.5"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			exampleVirtualHubIp,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const exampleVirtualHub = new azure.network.VirtualHub("exampleVirtualHub", {
        resourceGroupName: exampleResourceGroup.name,
        location: exampleResourceGroup.location,
        sku: "Standard",
    });
    const examplePublicIp = new azure.network.PublicIp("examplePublicIp", {
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        allocationMethod: "Dynamic",
    });
    const exampleVirtualNetwork = new azure.network.VirtualNetwork("exampleVirtualNetwork", {
        addressSpaces: ["10.5.0.0/16"],
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
    });
    const exampleSubnet = new azure.network.Subnet("exampleSubnet", {
        resourceGroupName: exampleResourceGroup.name,
        virtualNetworkName: exampleVirtualNetwork.name,
        addressPrefix: "10.5.1.0/24",
    });
    const exampleVirtualHubIp = new azure.network.VirtualHubIp("exampleVirtualHubIp", {
        virtualHubId: exampleVirtualHub.id,
        privateIpAddress: "10.5.1.18",
        privateIpAllocationMethod: "Static",
        publicIpAddressId: examplePublicIp.id,
        subnetId: exampleSubnet.id,
    });
    const exampleBgpConnection = new azure.network.BgpConnection("exampleBgpConnection", {
        virtualHubId: exampleVirtualHub.id,
        peerAsn: 65514,
        peerIp: "169.254.21.5",
    }, {
        dependsOn: [exampleVirtualHubIp],
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_virtual_hub = azure.network.VirtualHub("exampleVirtualHub",
        resource_group_name=example_resource_group.name,
        location=example_resource_group.location,
        sku="Standard")
    example_public_ip = azure.network.PublicIp("examplePublicIp",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        allocation_method="Dynamic")
    example_virtual_network = azure.network.VirtualNetwork("exampleVirtualNetwork",
        address_spaces=["10.5.0.0/16"],
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name)
    example_subnet = azure.network.Subnet("exampleSubnet",
        resource_group_name=example_resource_group.name,
        virtual_network_name=example_virtual_network.name,
        address_prefix="10.5.1.0/24")
    example_virtual_hub_ip = azure.network.VirtualHubIp("exampleVirtualHubIp",
        virtual_hub_id=example_virtual_hub.id,
        private_ip_address="10.5.1.18",
        private_ip_allocation_method="Static",
        public_ip_address_id=example_public_ip.id,
        subnet_id=example_subnet.id)
    example_bgp_connection = azure.network.BgpConnection("exampleBgpConnection",
        virtual_hub_id=example_virtual_hub.id,
        peer_asn=65514,
        peer_ip="169.254.21.5",
        opts=pulumi.ResourceOptions(depends_on=[example_virtual_hub_ip]))
    

    Example coming soon!

    Create BgpConnection Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new BgpConnection(name: string, args: BgpConnectionArgs, opts?: CustomResourceOptions);
    @overload
    def BgpConnection(resource_name: str,
                      args: BgpConnectionArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def BgpConnection(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      peer_asn: Optional[int] = None,
                      peer_ip: Optional[str] = None,
                      virtual_hub_id: Optional[str] = None,
                      name: Optional[str] = None)
    func NewBgpConnection(ctx *Context, name string, args BgpConnectionArgs, opts ...ResourceOption) (*BgpConnection, error)
    public BgpConnection(string name, BgpConnectionArgs args, CustomResourceOptions? opts = null)
    public BgpConnection(String name, BgpConnectionArgs args)
    public BgpConnection(String name, BgpConnectionArgs args, CustomResourceOptions options)
    
    type: azure:network:BgpConnection
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args BgpConnectionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args BgpConnectionArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args BgpConnectionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BgpConnectionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BgpConnectionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var bgpConnectionResource = new Azure.Network.BgpConnection("bgpConnectionResource", new()
    {
        PeerAsn = 0,
        PeerIp = "string",
        VirtualHubId = "string",
        Name = "string",
    });
    
    example, err := network.NewBgpConnection(ctx, "bgpConnectionResource", &network.BgpConnectionArgs{
    	PeerAsn:      pulumi.Int(0),
    	PeerIp:       pulumi.String("string"),
    	VirtualHubId: pulumi.String("string"),
    	Name:         pulumi.String("string"),
    })
    
    var bgpConnectionResource = new BgpConnection("bgpConnectionResource", BgpConnectionArgs.builder()
        .peerAsn(0)
        .peerIp("string")
        .virtualHubId("string")
        .name("string")
        .build());
    
    bgp_connection_resource = azure.network.BgpConnection("bgpConnectionResource",
        peer_asn=0,
        peer_ip="string",
        virtual_hub_id="string",
        name="string")
    
    const bgpConnectionResource = new azure.network.BgpConnection("bgpConnectionResource", {
        peerAsn: 0,
        peerIp: "string",
        virtualHubId: "string",
        name: "string",
    });
    
    type: azure:network:BgpConnection
    properties:
        name: string
        peerAsn: 0
        peerIp: string
        virtualHubId: string
    

    BgpConnection Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The BgpConnection resource accepts the following input properties:

    PeerAsn int
    The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    PeerIp string
    The peer ip address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    VirtualHubId string
    The ID of the Virtual Hub within which this Bgp connection should be created. Changing this forces a new resource to be created.
    Name string
    The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    PeerAsn int
    The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    PeerIp string
    The peer ip address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    VirtualHubId string
    The ID of the Virtual Hub within which this Bgp connection should be created. Changing this forces a new resource to be created.
    Name string
    The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peerAsn Integer
    The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peerIp String
    The peer ip address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    virtualHubId String
    The ID of the Virtual Hub within which this Bgp connection should be created. Changing this forces a new resource to be created.
    name String
    The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peerAsn number
    The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peerIp string
    The peer ip address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    virtualHubId string
    The ID of the Virtual Hub within which this Bgp connection should be created. Changing this forces a new resource to be created.
    name string
    The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peer_asn int
    The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peer_ip str
    The peer ip address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    virtual_hub_id str
    The ID of the Virtual Hub within which this Bgp connection should be created. Changing this forces a new resource to be created.
    name str
    The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peerAsn Number
    The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peerIp String
    The peer ip address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    virtualHubId String
    The ID of the Virtual Hub within which this Bgp connection should be created. Changing this forces a new resource to be created.
    name String
    The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the BgpConnection resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing BgpConnection Resource

    Get an existing BgpConnection resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: BgpConnectionState, opts?: CustomResourceOptions): BgpConnection
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            peer_asn: Optional[int] = None,
            peer_ip: Optional[str] = None,
            virtual_hub_id: Optional[str] = None) -> BgpConnection
    func GetBgpConnection(ctx *Context, name string, id IDInput, state *BgpConnectionState, opts ...ResourceOption) (*BgpConnection, error)
    public static BgpConnection Get(string name, Input<string> id, BgpConnectionState? state, CustomResourceOptions? opts = null)
    public static BgpConnection get(String name, Output<String> id, BgpConnectionState state, CustomResourceOptions options)
    resources:  _:    type: azure:network:BgpConnection    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Name string
    The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    PeerAsn int
    The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    PeerIp string
    The peer ip address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    VirtualHubId string
    The ID of the Virtual Hub within which this Bgp connection should be created. Changing this forces a new resource to be created.
    Name string
    The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    PeerAsn int
    The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    PeerIp string
    The peer ip address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    VirtualHubId string
    The ID of the Virtual Hub within which this Bgp connection should be created. Changing this forces a new resource to be created.
    name String
    The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peerAsn Integer
    The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peerIp String
    The peer ip address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    virtualHubId String
    The ID of the Virtual Hub within which this Bgp connection should be created. Changing this forces a new resource to be created.
    name string
    The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peerAsn number
    The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peerIp string
    The peer ip address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    virtualHubId string
    The ID of the Virtual Hub within which this Bgp connection should be created. Changing this forces a new resource to be created.
    name str
    The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peer_asn int
    The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peer_ip str
    The peer ip address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    virtual_hub_id str
    The ID of the Virtual Hub within which this Bgp connection should be created. Changing this forces a new resource to be created.
    name String
    The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peerAsn Number
    The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    peerIp String
    The peer ip address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.
    virtualHubId String
    The ID of the Virtual Hub within which this Bgp connection should be created. Changing this forces a new resource to be created.

    Import

    Virtual Hub Bgp Connections can be imported using the resource id, e.g.

     $ pulumi import azure:network/bgpConnection:BgpConnection example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/virtualHubs/virtualHub1/bgpConnections/connection1
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Viewing docs for Azure v4.42.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.