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

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.network.getVirtualHub

Explore with Pulumi AI

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

Uses this data source to access information about an existing Virtual Hub.

Virtual Hub Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.network.getVirtualHub({
    name: "example-hub",
    resourceGroupName: "example-resources",
});
export const virtualHubId = example.then(example => example.id);
Copy
import pulumi
import pulumi_azure as azure

example = azure.network.get_virtual_hub(name="example-hub",
    resource_group_name="example-resources")
pulumi.export("virtualHubId", example.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := network.LookupVirtualHub(ctx, &network.LookupVirtualHubArgs{
			Name:              "example-hub",
			ResourceGroupName: "example-resources",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("virtualHubId", example.Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.Network.GetVirtualHub.Invoke(new()
    {
        Name = "example-hub",
        ResourceGroupName = "example-resources",
    });

    return new Dictionary<string, object?>
    {
        ["virtualHubId"] = example.Apply(getVirtualHubResult => getVirtualHubResult.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.network.NetworkFunctions;
import com.pulumi.azure.network.inputs.GetVirtualHubArgs;
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) {
        final var example = NetworkFunctions.getVirtualHub(GetVirtualHubArgs.builder()
            .name("example-hub")
            .resourceGroupName("example-resources")
            .build());

        ctx.export("virtualHubId", example.applyValue(getVirtualHubResult -> getVirtualHubResult.id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:network:getVirtualHub
      arguments:
        name: example-hub
        resourceGroupName: example-resources
outputs:
  virtualHubId: ${example.id}
Copy

Using getVirtualHub

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getVirtualHub(args: GetVirtualHubArgs, opts?: InvokeOptions): Promise<GetVirtualHubResult>
function getVirtualHubOutput(args: GetVirtualHubOutputArgs, opts?: InvokeOptions): Output<GetVirtualHubResult>
Copy
def get_virtual_hub(name: Optional[str] = None,
                    resource_group_name: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetVirtualHubResult
def get_virtual_hub_output(name: Optional[pulumi.Input[str]] = None,
                    resource_group_name: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetVirtualHubResult]
Copy
func LookupVirtualHub(ctx *Context, args *LookupVirtualHubArgs, opts ...InvokeOption) (*LookupVirtualHubResult, error)
func LookupVirtualHubOutput(ctx *Context, args *LookupVirtualHubOutputArgs, opts ...InvokeOption) LookupVirtualHubResultOutput
Copy

> Note: This function is named LookupVirtualHub in the Go SDK.

public static class GetVirtualHub 
{
    public static Task<GetVirtualHubResult> InvokeAsync(GetVirtualHubArgs args, InvokeOptions? opts = null)
    public static Output<GetVirtualHubResult> Invoke(GetVirtualHubInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetVirtualHubResult> getVirtualHub(GetVirtualHubArgs args, InvokeOptions options)
public static Output<GetVirtualHubResult> getVirtualHub(GetVirtualHubArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:network/getVirtualHub:getVirtualHub
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the Virtual Hub.
ResourceGroupName This property is required. string
The Name of the Resource Group where the Virtual Hub exists.
Name This property is required. string
The name of the Virtual Hub.
ResourceGroupName This property is required. string
The Name of the Resource Group where the Virtual Hub exists.
name This property is required. String
The name of the Virtual Hub.
resourceGroupName This property is required. String
The Name of the Resource Group where the Virtual Hub exists.
name This property is required. string
The name of the Virtual Hub.
resourceGroupName This property is required. string
The Name of the Resource Group where the Virtual Hub exists.
name This property is required. str
The name of the Virtual Hub.
resource_group_name This property is required. str
The Name of the Resource Group where the Virtual Hub exists.
name This property is required. String
The name of the Virtual Hub.
resourceGroupName This property is required. String
The Name of the Resource Group where the Virtual Hub exists.

getVirtualHub Result

The following output properties are available:

AddressPrefix string
The Address Prefix used for this Virtual Hub.
DefaultRouteTableId string
The ID of the default Route Table in the Virtual Hub.
Id string
The provider-assigned unique ID for this managed resource.
Location string
The Azure Region where the Virtual Hub exists.
Name string
ResourceGroupName string
Tags Dictionary<string, string>
A mapping of tags assigned to the Virtual Hub.
VirtualRouterAsn int
The Autonomous System Number of the Virtual Hub BGP router.
VirtualRouterIps List<string>
The IP addresses of the Virtual Hub BGP router.
VirtualWanId string
The ID of the Virtual WAN within which the Virtual Hub exists.
AddressPrefix string
The Address Prefix used for this Virtual Hub.
DefaultRouteTableId string
The ID of the default Route Table in the Virtual Hub.
Id string
The provider-assigned unique ID for this managed resource.
Location string
The Azure Region where the Virtual Hub exists.
Name string
ResourceGroupName string
Tags map[string]string
A mapping of tags assigned to the Virtual Hub.
VirtualRouterAsn int
The Autonomous System Number of the Virtual Hub BGP router.
VirtualRouterIps []string
The IP addresses of the Virtual Hub BGP router.
VirtualWanId string
The ID of the Virtual WAN within which the Virtual Hub exists.
addressPrefix String
The Address Prefix used for this Virtual Hub.
defaultRouteTableId String
The ID of the default Route Table in the Virtual Hub.
id String
The provider-assigned unique ID for this managed resource.
location String
The Azure Region where the Virtual Hub exists.
name String
resourceGroupName String
tags Map<String,String>
A mapping of tags assigned to the Virtual Hub.
virtualRouterAsn Integer
The Autonomous System Number of the Virtual Hub BGP router.
virtualRouterIps List<String>
The IP addresses of the Virtual Hub BGP router.
virtualWanId String
The ID of the Virtual WAN within which the Virtual Hub exists.
addressPrefix string
The Address Prefix used for this Virtual Hub.
defaultRouteTableId string
The ID of the default Route Table in the Virtual Hub.
id string
The provider-assigned unique ID for this managed resource.
location string
The Azure Region where the Virtual Hub exists.
name string
resourceGroupName string
tags {[key: string]: string}
A mapping of tags assigned to the Virtual Hub.
virtualRouterAsn number
The Autonomous System Number of the Virtual Hub BGP router.
virtualRouterIps string[]
The IP addresses of the Virtual Hub BGP router.
virtualWanId string
The ID of the Virtual WAN within which the Virtual Hub exists.
address_prefix str
The Address Prefix used for this Virtual Hub.
default_route_table_id str
The ID of the default Route Table in the Virtual Hub.
id str
The provider-assigned unique ID for this managed resource.
location str
The Azure Region where the Virtual Hub exists.
name str
resource_group_name str
tags Mapping[str, str]
A mapping of tags assigned to the Virtual Hub.
virtual_router_asn int
The Autonomous System Number of the Virtual Hub BGP router.
virtual_router_ips Sequence[str]
The IP addresses of the Virtual Hub BGP router.
virtual_wan_id str
The ID of the Virtual WAN within which the Virtual Hub exists.
addressPrefix String
The Address Prefix used for this Virtual Hub.
defaultRouteTableId String
The ID of the default Route Table in the Virtual Hub.
id String
The provider-assigned unique ID for this managed resource.
location String
The Azure Region where the Virtual Hub exists.
name String
resourceGroupName String
tags Map<String>
A mapping of tags assigned to the Virtual Hub.
virtualRouterAsn Number
The Autonomous System Number of the Virtual Hub BGP router.
virtualRouterIps List<String>
The IP addresses of the Virtual Hub BGP router.
virtualWanId String
The ID of the Virtual WAN within which the Virtual Hub exists.

Package Details

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

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi