We recommend using Azure Native.
Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi
azure.servicebus.getSubscription
Explore with Pulumi AI
Use this data source to access information about an existing ServiceBus Subscription.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.servicebus.getSubscription({
    name: "examplesubscription",
    topicId: "exampletopic",
});
export const servicebusSubscription = exampleAzurermServicebusNamespace;
import pulumi
import pulumi_azure as azure
example = azure.servicebus.get_subscription(name="examplesubscription",
    topic_id="exampletopic")
pulumi.export("servicebusSubscription", example_azurerm_servicebus_namespace)
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/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",
			TopicId: pulumi.StringRef("exampletopic"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("servicebusSubscription", exampleAzurermServicebusNamespace)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var example = Azure.ServiceBus.GetSubscription.Invoke(new()
    {
        Name = "examplesubscription",
        TopicId = "exampletopic",
    });
    return new Dictionary<string, object?>
    {
        ["servicebusSubscription"] = exampleAzurermServicebusNamespace,
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.servicebus.ServicebusFunctions;
import com.pulumi.azure.servicebus.inputs.GetSubscriptionArgs;
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 = ServicebusFunctions.getSubscription(GetSubscriptionArgs.builder()
            .name("examplesubscription")
            .topicId("exampletopic")
            .build());
        ctx.export("servicebusSubscription", exampleAzurermServicebusNamespace);
    }
}
variables:
  example:
    fn::invoke:
      function: azure:servicebus:getSubscription
      arguments:
        name: examplesubscription
        topicId: exampletopic
outputs:
  servicebusSubscription: ${exampleAzurermServicebusNamespace}
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 dictionaryThe following arguments are supported:
- Name string
- Specifies the name of the ServiceBus Subscription.
- NamespaceName string
- ResourceGroup stringName 
- TopicId string
- The ID of the ServiceBus Topic where the Service Bus Subscription exists.
- TopicName string
- Name string
- Specifies the name of the ServiceBus Subscription.
- NamespaceName string
- ResourceGroup stringName 
- TopicId string
- The ID of the ServiceBus Topic where the Service Bus Subscription exists.
- TopicName string
- name String
- Specifies the name of the ServiceBus Subscription.
- namespaceName String
- resourceGroup StringName 
- topicId String
- The ID of the ServiceBus Topic where the Service Bus Subscription exists.
- topicName String
- name string
- Specifies the name of the ServiceBus Subscription.
- namespaceName string
- resourceGroup stringName 
- topicId string
- The ID of the ServiceBus Topic where the Service Bus Subscription exists.
- topicName string
- name str
- Specifies the name of the ServiceBus Subscription.
- namespace_name str
- resource_group_ strname 
- topic_id str
- The ID of the ServiceBus Topic where the Service Bus Subscription exists.
- topic_name str
- name String
- Specifies the name of the ServiceBus Subscription.
- namespaceName String
- resourceGroup StringName 
- topicId String
- The ID of the ServiceBus Topic where the Service Bus Subscription exists.
- topicName String
getSubscription Result
The following output properties are available:
- AutoDelete stringOn Idle 
- The idle interval after which the Subscription is automatically deleted.
- BatchedOperations boolEnabled 
- Whether batched operations are enabled.
- DeadLettering boolOn Filter Evaluation Error 
- Does the ServiceBus Subscription have dead letter support on filter evaluation exceptions?
- DeadLettering boolOn Message Expiration 
- Does the Service Bus Subscription have dead letter support when a message expires?
- DefaultMessage stringTtl 
- 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.
- EnableBatched boolOperations 
- ForwardDead stringLettered Messages To 
- 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.
- MaxDelivery intCount 
- The maximum number of deliveries.
- Name string
- RequiresSession bool
- Whether this ServiceBus Subscription supports session.
- NamespaceName string
- ResourceGroup stringName 
- TopicId string
- TopicName string
- AutoDelete stringOn Idle 
- The idle interval after which the Subscription is automatically deleted.
- BatchedOperations boolEnabled 
- Whether batched operations are enabled.
- DeadLettering boolOn Filter Evaluation Error 
- Does the ServiceBus Subscription have dead letter support on filter evaluation exceptions?
- DeadLettering boolOn Message Expiration 
- Does the Service Bus Subscription have dead letter support when a message expires?
- DefaultMessage stringTtl 
- 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.
- EnableBatched boolOperations 
- ForwardDead stringLettered Messages To 
- 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.
- MaxDelivery intCount 
- The maximum number of deliveries.
- Name string
- RequiresSession bool
- Whether this ServiceBus Subscription supports session.
- NamespaceName string
- ResourceGroup stringName 
- TopicId string
- TopicName string
- autoDelete StringOn Idle 
- The idle interval after which the Subscription is automatically deleted.
- batchedOperations BooleanEnabled 
- Whether batched operations are enabled.
- deadLettering BooleanOn Filter Evaluation Error 
- Does the ServiceBus Subscription have dead letter support on filter evaluation exceptions?
- deadLettering BooleanOn Message Expiration 
- Does the Service Bus Subscription have dead letter support when a message expires?
- defaultMessage StringTtl 
- 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.
- enableBatched BooleanOperations 
- forwardDead StringLettered Messages To 
- 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.
- maxDelivery IntegerCount 
- The maximum number of deliveries.
- name String
- requiresSession Boolean
- Whether this ServiceBus Subscription supports session.
- namespaceName String
- resourceGroup StringName 
- topicId String
- topicName String
- autoDelete stringOn Idle 
- The idle interval after which the Subscription is automatically deleted.
- batchedOperations booleanEnabled 
- Whether batched operations are enabled.
- deadLettering booleanOn Filter Evaluation Error 
- Does the ServiceBus Subscription have dead letter support on filter evaluation exceptions?
- deadLettering booleanOn Message Expiration 
- Does the Service Bus Subscription have dead letter support when a message expires?
- defaultMessage stringTtl 
- 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.
- enableBatched booleanOperations 
- forwardDead stringLettered Messages To 
- 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.
- maxDelivery numberCount 
- The maximum number of deliveries.
- name string
- requiresSession boolean
- Whether this ServiceBus Subscription supports session.
- namespaceName string
- resourceGroup stringName 
- topicId string
- topicName string
- auto_delete_ stron_ idle 
- The idle interval after which the Subscription is automatically deleted.
- batched_operations_ boolenabled 
- Whether batched operations are enabled.
- dead_lettering_ boolon_ filter_ evaluation_ error 
- Does the ServiceBus Subscription have dead letter support on filter evaluation exceptions?
- dead_lettering_ boolon_ message_ expiration 
- Does the Service Bus Subscription have dead letter support when a message expires?
- default_message_ strttl 
- 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_ booloperations 
- forward_dead_ strlettered_ messages_ to 
- 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_ intcount 
- The maximum number of deliveries.
- name str
- requires_session bool
- Whether this ServiceBus Subscription supports session.
- namespace_name str
- resource_group_ strname 
- topic_id str
- topic_name str
- autoDelete StringOn Idle 
- The idle interval after which the Subscription is automatically deleted.
- batchedOperations BooleanEnabled 
- Whether batched operations are enabled.
- deadLettering BooleanOn Filter Evaluation Error 
- Does the ServiceBus Subscription have dead letter support on filter evaluation exceptions?
- deadLettering BooleanOn Message Expiration 
- Does the Service Bus Subscription have dead letter support when a message expires?
- defaultMessage StringTtl 
- 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.
- enableBatched BooleanOperations 
- forwardDead StringLettered Messages To 
- 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.
- maxDelivery NumberCount 
- The maximum number of deliveries.
- name String
- requiresSession Boolean
- Whether this ServiceBus Subscription supports session.
- namespaceName String
- resourceGroup StringName 
- topicId String
- topicName String
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azurermTerraform Provider.