1. Packages
  2. Azure Classic
  3. API Docs
  4. servicebus
  5. getSubscription

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

    Use this data source to access information about an existing ServiceBus Subscription.

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var example = Output.Create(Azure.ServiceBus.GetSubscription.InvokeAsync(new Azure.ServiceBus.GetSubscriptionArgs
            {
                Name = "examplesubscription",
                ResourceGroupName = "exampleresources",
                NamespaceName = "examplenamespace",
                TopicName = "exampletopic",
            }));
            this.ServicebusSubscription = data.Azurerm_servicebus_namespace.Example;
        }
    
        [Output("servicebusSubscription")]
        public Output<string> ServicebusSubscription { get; set; }
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/servicebus"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := servicebus.LookupSubscription(ctx, &servicebus.LookupSubscriptionArgs{
    			Name:              "examplesubscription",
    			ResourceGroupName: pulumi.StringRef("exampleresources"),
    			NamespaceName:     pulumi.StringRef("examplenamespace"),
    			TopicName:         pulumi.StringRef("exampletopic"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("servicebusSubscription", data.Azurerm_servicebus_namespace.Example)
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.servicebus.getSubscription({
        name: "examplesubscription",
        resourceGroupName: "exampleresources",
        namespaceName: "examplenamespace",
        topicName: "exampletopic",
    });
    export const servicebusSubscription = data.azurerm_servicebus_namespace.example;
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.servicebus.get_subscription(name="examplesubscription",
        resource_group_name="exampleresources",
        namespace_name="examplenamespace",
        topic_name="exampletopic")
    pulumi.export("servicebusSubscription", data["azurerm_servicebus_namespace"]["example"])
    

    Example coming soon!

    Using getSubscription

    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 getSubscription(args: GetSubscriptionArgs, opts?: InvokeOptions): Promise<GetSubscriptionResult>
    function getSubscriptionOutput(args: GetSubscriptionOutputArgs, opts?: InvokeOptions): Output<GetSubscriptionResult>
    def get_subscription(name: Optional[str] = None,
                         namespace_name: Optional[str] = None,
                         resource_group_name: Optional[str] = None,
                         topic_id: Optional[str] = None,
                         topic_name: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetSubscriptionResult
    def get_subscription_output(name: Optional[pulumi.Input[str]] = None,
                         namespace_name: Optional[pulumi.Input[str]] = None,
                         resource_group_name: Optional[pulumi.Input[str]] = None,
                         topic_id: Optional[pulumi.Input[str]] = None,
                         topic_name: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetSubscriptionResult]
    func LookupSubscription(ctx *Context, args *LookupSubscriptionArgs, opts ...InvokeOption) (*LookupSubscriptionResult, error)
    func LookupSubscriptionOutput(ctx *Context, args *LookupSubscriptionOutputArgs, opts ...InvokeOption) LookupSubscriptionResultOutput

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

    public static class GetSubscription 
    {
        public static Task<GetSubscriptionResult> InvokeAsync(GetSubscriptionArgs args, InvokeOptions? opts = null)
        public static Output<GetSubscriptionResult> Invoke(GetSubscriptionInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSubscriptionResult> getSubscription(GetSubscriptionArgs args, InvokeOptions options)
    public static Output<GetSubscriptionResult> getSubscription(GetSubscriptionArgs args, InvokeOptions options)
    
    fn::invoke:
      function: azure:servicebus/getSubscription:getSubscription
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Specifies the name of the ServiceBus Subscription.
    NamespaceName string
    The name of the ServiceBus Namespace.
    ResourceGroupName string
    Specifies the name of the Resource Group where the ServiceBus Namespace exists.
    TopicId string
    TopicName string
    The name of the ServiceBus Topic.
    Name string
    Specifies the name of the ServiceBus Subscription.
    NamespaceName string
    The name of the ServiceBus Namespace.
    ResourceGroupName string
    Specifies the name of the Resource Group where the ServiceBus Namespace exists.
    TopicId string
    TopicName string
    The name of the ServiceBus Topic.
    name String
    Specifies the name of the ServiceBus Subscription.
    namespaceName String
    The name of the ServiceBus Namespace.
    resourceGroupName String
    Specifies the name of the Resource Group where the ServiceBus Namespace exists.
    topicId String
    topicName String
    The name of the ServiceBus Topic.
    name string
    Specifies the name of the ServiceBus Subscription.
    namespaceName string
    The name of the ServiceBus Namespace.
    resourceGroupName string
    Specifies the name of the Resource Group where the ServiceBus Namespace exists.
    topicId string
    topicName string
    The name of the ServiceBus Topic.
    name str
    Specifies the name of the ServiceBus Subscription.
    namespace_name str
    The name of the ServiceBus Namespace.
    resource_group_name str
    Specifies the name of the Resource Group where the ServiceBus Namespace exists.
    topic_id str
    topic_name str
    The name of the ServiceBus Topic.
    name String
    Specifies the name of the ServiceBus Subscription.
    namespaceName String
    The name of the ServiceBus Namespace.
    resourceGroupName String
    Specifies the name of the Resource Group where the ServiceBus Namespace exists.
    topicId String
    topicName String
    The name of the ServiceBus Topic.

    getSubscription Result

    The following output properties are available:

    AutoDeleteOnIdle string
    The idle interval after which the topic is automatically deleted.
    DeadLetteringOnFilterEvaluationError bool
    Does the ServiceBus Subscription have dead letter support on filter evaluation exceptions?
    DeadLetteringOnMessageExpiration bool
    Does the Service Bus Subscription have dead letter support when a message expires?
    DefaultMessageTtl string
    The Default message timespan to live. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself.
    EnableBatchedOperations bool
    Are batched operations enabled on this ServiceBus Subscription?
    ForwardDeadLetteredMessagesTo string
    The name of a Queue or Topic to automatically forward Dead Letter messages to.
    ForwardTo string
    The name of a ServiceBus Queue or ServiceBus Topic where messages are automatically forwarded.
    Id string
    The provider-assigned unique ID for this managed resource.
    LockDuration string
    The lock duration for the subscription.
    MaxDeliveryCount int
    The maximum number of deliveries.
    Name string
    RequiresSession bool
    Whether or not this ServiceBus Subscription supports session.
    NamespaceName string
    ResourceGroupName string
    TopicId string
    TopicName string
    AutoDeleteOnIdle string
    The idle interval after which the topic is automatically deleted.
    DeadLetteringOnFilterEvaluationError bool
    Does the ServiceBus Subscription have dead letter support on filter evaluation exceptions?
    DeadLetteringOnMessageExpiration bool
    Does the Service Bus Subscription have dead letter support when a message expires?
    DefaultMessageTtl string
    The Default message timespan to live. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself.
    EnableBatchedOperations bool
    Are batched operations enabled on this ServiceBus Subscription?
    ForwardDeadLetteredMessagesTo string
    The name of a Queue or Topic to automatically forward Dead Letter messages to.
    ForwardTo string
    The name of a ServiceBus Queue or ServiceBus Topic where messages are automatically forwarded.
    Id string
    The provider-assigned unique ID for this managed resource.
    LockDuration string
    The lock duration for the subscription.
    MaxDeliveryCount int
    The maximum number of deliveries.
    Name string
    RequiresSession bool
    Whether or not this ServiceBus Subscription supports session.
    NamespaceName string
    ResourceGroupName string
    TopicId string
    TopicName string
    autoDeleteOnIdle String
    The idle interval after which the topic is automatically deleted.
    deadLetteringOnFilterEvaluationError Boolean
    Does the ServiceBus Subscription have dead letter support on filter evaluation exceptions?
    deadLetteringOnMessageExpiration Boolean
    Does the Service Bus Subscription have dead letter support when a message expires?
    defaultMessageTtl String
    The Default message timespan to live. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself.
    enableBatchedOperations Boolean
    Are batched operations enabled on this ServiceBus Subscription?
    forwardDeadLetteredMessagesTo String
    The name of a Queue or Topic to automatically forward Dead Letter messages to.
    forwardTo String
    The name of a ServiceBus Queue or ServiceBus Topic where messages are automatically forwarded.
    id String
    The provider-assigned unique ID for this managed resource.
    lockDuration String
    The lock duration for the subscription.
    maxDeliveryCount Integer
    The maximum number of deliveries.
    name String
    requiresSession Boolean
    Whether or not this ServiceBus Subscription supports session.
    namespaceName String
    resourceGroupName String
    topicId String
    topicName String
    autoDeleteOnIdle string
    The idle interval after which the topic is automatically deleted.
    deadLetteringOnFilterEvaluationError boolean
    Does the ServiceBus Subscription have dead letter support on filter evaluation exceptions?
    deadLetteringOnMessageExpiration boolean
    Does the Service Bus Subscription have dead letter support when a message expires?
    defaultMessageTtl string
    The Default message timespan to live. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself.
    enableBatchedOperations boolean
    Are batched operations enabled on this ServiceBus Subscription?
    forwardDeadLetteredMessagesTo string
    The name of a Queue or Topic to automatically forward Dead Letter messages to.
    forwardTo string
    The name of a ServiceBus Queue or ServiceBus Topic where messages are automatically forwarded.
    id string
    The provider-assigned unique ID for this managed resource.
    lockDuration string
    The lock duration for the subscription.
    maxDeliveryCount number
    The maximum number of deliveries.
    name string
    requiresSession boolean
    Whether or not this ServiceBus Subscription supports session.
    namespaceName string
    resourceGroupName string
    topicId string
    topicName string
    auto_delete_on_idle str
    The idle interval after which the topic is automatically deleted.
    dead_lettering_on_filter_evaluation_error bool
    Does the ServiceBus Subscription have dead letter support on filter evaluation exceptions?
    dead_lettering_on_message_expiration bool
    Does the Service Bus Subscription have dead letter support when a message expires?
    default_message_ttl str
    The Default message timespan to live. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself.
    enable_batched_operations bool
    Are batched operations enabled on this ServiceBus Subscription?
    forward_dead_lettered_messages_to str
    The name of a Queue or Topic to automatically forward Dead Letter messages to.
    forward_to str
    The name of a ServiceBus Queue or ServiceBus Topic where messages are automatically forwarded.
    id str
    The provider-assigned unique ID for this managed resource.
    lock_duration str
    The lock duration for the subscription.
    max_delivery_count int
    The maximum number of deliveries.
    name str
    requires_session bool
    Whether or not this ServiceBus Subscription supports session.
    namespace_name str
    resource_group_name str
    topic_id str
    topic_name str
    autoDeleteOnIdle String
    The idle interval after which the topic is automatically deleted.
    deadLetteringOnFilterEvaluationError Boolean
    Does the ServiceBus Subscription have dead letter support on filter evaluation exceptions?
    deadLetteringOnMessageExpiration Boolean
    Does the Service Bus Subscription have dead letter support when a message expires?
    defaultMessageTtl String
    The Default message timespan to live. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself.
    enableBatchedOperations Boolean
    Are batched operations enabled on this ServiceBus Subscription?
    forwardDeadLetteredMessagesTo String
    The name of a Queue or Topic to automatically forward Dead Letter messages to.
    forwardTo String
    The name of a ServiceBus Queue or ServiceBus Topic where messages are automatically forwarded.
    id String
    The provider-assigned unique ID for this managed resource.
    lockDuration String
    The lock duration for the subscription.
    maxDeliveryCount Number
    The maximum number of deliveries.
    name String
    requiresSession Boolean
    Whether or not this ServiceBus Subscription supports session.
    namespaceName String
    resourceGroupName String
    topicId String
    topicName String

    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.