We recommend using Azure Native.
Azure v6.28.0 published on Friday, Oct 3, 2025 by Pulumi
azure.eventhub.getEventHub
Use this data source to access information about an existing EventHub.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.eventhub.getEventHub({
    name: "search-eventhub",
    resourceGroupName: "search-service",
    namespaceName: "search-eventhubns",
});
export const eventhubId = example.then(example => example.id);
import pulumi
import pulumi_azure as azure
example = azure.eventhub.get_event_hub(name="search-eventhub",
    resource_group_name="search-service",
    namespace_name="search-eventhubns")
pulumi.export("eventhubId", example.id)
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/eventhub"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := eventhub.LookupEventHub(ctx, &eventhub.LookupEventHubArgs{
			Name:              "search-eventhub",
			ResourceGroupName: "search-service",
			NamespaceName:     "search-eventhubns",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("eventhubId", example.Id)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var example = Azure.EventHub.GetEventHub.Invoke(new()
    {
        Name = "search-eventhub",
        ResourceGroupName = "search-service",
        NamespaceName = "search-eventhubns",
    });
    return new Dictionary<string, object?>
    {
        ["eventhubId"] = example.Apply(getEventHubResult => getEventHubResult.Id),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.eventhub.EventhubFunctions;
import com.pulumi.azure.eventhub.inputs.GetEventHubArgs;
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 = EventhubFunctions.getEventHub(GetEventHubArgs.builder()
            .name("search-eventhub")
            .resourceGroupName("search-service")
            .namespaceName("search-eventhubns")
            .build());
        ctx.export("eventhubId", example.id());
    }
}
variables:
  example:
    fn::invoke:
      function: azure:eventhub:getEventHub
      arguments:
        name: search-eventhub
        resourceGroupName: search-service
        namespaceName: search-eventhubns
outputs:
  eventhubId: ${example.id}
API Providers
This data source uses the following Azure API Providers:
- Microsoft.EventHub- 2024-01-01
Using getEventHub
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 getEventHub(args: GetEventHubArgs, opts?: InvokeOptions): Promise<GetEventHubResult>
function getEventHubOutput(args: GetEventHubOutputArgs, opts?: InvokeOptions): Output<GetEventHubResult>def get_event_hub(name: Optional[str] = None,
                  namespace_name: Optional[str] = None,
                  resource_group_name: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetEventHubResult
def get_event_hub_output(name: Optional[pulumi.Input[str]] = None,
                  namespace_name: Optional[pulumi.Input[str]] = None,
                  resource_group_name: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetEventHubResult]func LookupEventHub(ctx *Context, args *LookupEventHubArgs, opts ...InvokeOption) (*LookupEventHubResult, error)
func LookupEventHubOutput(ctx *Context, args *LookupEventHubOutputArgs, opts ...InvokeOption) LookupEventHubResultOutput> Note: This function is named LookupEventHub in the Go SDK.
public static class GetEventHub 
{
    public static Task<GetEventHubResult> InvokeAsync(GetEventHubArgs args, InvokeOptions? opts = null)
    public static Output<GetEventHubResult> Invoke(GetEventHubInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetEventHubResult> getEventHub(GetEventHubArgs args, InvokeOptions options)
public static Output<GetEventHubResult> getEventHub(GetEventHubArgs args, InvokeOptions options)
fn::invoke:
  function: azure:eventhub/getEventHub:getEventHub
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Name string
- The name of this EventHub.
- NamespaceName string
- The name of the EventHub Namespace where the EventHub exists.
- ResourceGroup stringName 
- The name of the Resource Group where the EventHub exists.
- Name string
- The name of this EventHub.
- NamespaceName string
- The name of the EventHub Namespace where the EventHub exists.
- ResourceGroup stringName 
- The name of the Resource Group where the EventHub exists.
- name String
- The name of this EventHub.
- namespaceName String
- The name of the EventHub Namespace where the EventHub exists.
- resourceGroup StringName 
- The name of the Resource Group where the EventHub exists.
- name string
- The name of this EventHub.
- namespaceName string
- The name of the EventHub Namespace where the EventHub exists.
- resourceGroup stringName 
- The name of the Resource Group where the EventHub exists.
- name str
- The name of this EventHub.
- namespace_name str
- The name of the EventHub Namespace where the EventHub exists.
- resource_group_ strname 
- The name of the Resource Group where the EventHub exists.
- name String
- The name of this EventHub.
- namespaceName String
- The name of the EventHub Namespace where the EventHub exists.
- resourceGroup StringName 
- The name of the Resource Group where the EventHub exists.
getEventHub Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- NamespaceName string
- PartitionCount int
- The number of partitions in the EventHub.
- PartitionIds List<string>
- The identifiers for the partitions of this EventHub.
- ResourceGroup stringName 
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- NamespaceName string
- PartitionCount int
- The number of partitions in the EventHub.
- PartitionIds []string
- The identifiers for the partitions of this EventHub.
- ResourceGroup stringName 
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- namespaceName String
- partitionCount Integer
- The number of partitions in the EventHub.
- partitionIds List<String>
- The identifiers for the partitions of this EventHub.
- resourceGroup StringName 
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- namespaceName string
- partitionCount number
- The number of partitions in the EventHub.
- partitionIds string[]
- The identifiers for the partitions of this EventHub.
- resourceGroup stringName 
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- namespace_name str
- partition_count int
- The number of partitions in the EventHub.
- partition_ids Sequence[str]
- The identifiers for the partitions of this EventHub.
- resource_group_ strname 
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- namespaceName String
- partitionCount Number
- The number of partitions in the EventHub.
- partitionIds List<String>
- The identifiers for the partitions of this EventHub.
- resourceGroup StringName 
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azurermTerraform Provider.
