1. Packages
  2. Azure Classic
  3. API Docs
  4. eventhub
  5. getEventHub

We recommend using Azure Native.

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

azure.eventhub.getEventHub

Explore with Pulumi AI

We recommend using Azure Native.

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

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);
Copy
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)
Copy
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
	})
}
Copy
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),
    };
});
Copy
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.applyValue(getEventHubResult -> getEventHubResult.id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:eventhub:getEventHub
      arguments:
        name: search-eventhub
        resourceGroupName: search-service
        namespaceName: search-eventhubns
outputs:
  eventhubId: ${example.id}
Copy

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>
Copy
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]
Copy
func LookupEventHub(ctx *Context, args *LookupEventHubArgs, opts ...InvokeOption) (*LookupEventHubResult, error)
func LookupEventHubOutput(ctx *Context, args *LookupEventHubOutputArgs, opts ...InvokeOption) LookupEventHubResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetEventHubResult> getEventHub(GetEventHubArgs args, InvokeOptions options)
public static Output<GetEventHubResult> getEventHub(GetEventHubArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:eventhub/getEventHub:getEventHub
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of this EventHub.
NamespaceName This property is required. string
The name of the EventHub Namespace where the EventHub exists.
ResourceGroupName This property is required. string
The name of the Resource Group where the EventHub exists.
Name This property is required. string
The name of this EventHub.
NamespaceName This property is required. string
The name of the EventHub Namespace where the EventHub exists.
ResourceGroupName This property is required. string
The name of the Resource Group where the EventHub exists.
name This property is required. String
The name of this EventHub.
namespaceName This property is required. String
The name of the EventHub Namespace where the EventHub exists.
resourceGroupName This property is required. String
The name of the Resource Group where the EventHub exists.
name This property is required. string
The name of this EventHub.
namespaceName This property is required. string
The name of the EventHub Namespace where the EventHub exists.
resourceGroupName This property is required. string
The name of the Resource Group where the EventHub exists.
name This property is required. str
The name of this EventHub.
namespace_name This property is required. str
The name of the EventHub Namespace where the EventHub exists.
resource_group_name This property is required. str
The name of the Resource Group where the EventHub exists.
name This property is required. String
The name of this EventHub.
namespaceName This property is required. String
The name of the EventHub Namespace where the EventHub exists.
resourceGroupName This property is required. String
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.
ResourceGroupName string
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.
ResourceGroupName string
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.
resourceGroupName String
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.
resourceGroupName string
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_name str
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.
resourceGroupName String

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