New-AzureRmServiceBusSubscription

Creates a subscription to the specified Service Bus topic.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

New-AzureRmServiceBusSubscription
   [-ResourceGroupName] <String>
   [-Namespace] <String>
   [-Topic] <String>
   [-Name] <String>
   [-AutoDeleteOnIdle <String>]
   [-DefaultMessageTimeToLive <String>]
   [-DeadLetteringOnMessageExpiration <Boolean>]
   [-DeadLetteringOnFilterEvaluationExceptions]
   [-EnableBatchedOperations <Boolean>]
   [-LockDuration <String>]
   [-MaxDeliveryCount <Int32>]
   [-RequiresSession <Boolean>]
   [-ForwardTo <String>]
   [-ForwardDeadLetteredMessagesTo <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-AzureRmServiceBusSubscription cmdlet creates a new subscription to the specified Service Bus topic.

Examples

Example 1

PS C:\> New-AzureRmServiceBusSubscription -ResourceGroup Default-ServiceBus-WestUS -NamespaceName SB-Example1 -TopicName SB-Topic_exampl1 -SubscriptionName SB-TopicSubscription-Example1

Name                                      : SB-TopicSubscription-Example1
AccessedAt                                : 1/20/2017 3:18:54 AM
AutoDeleteOnIdle                          : 10675199.02:48:05.4775807
CountDetails                              : Microsoft.Azure.Management.ServiceBus.Models.MessageCountDetails
CreatedAt                                 : 1/20/2017 3:18:52 AM
DefaultMessageTimeToLive                  : 10675199.02:48:05.4775807
DeadLetteringOnMessageExpiration          : False
EnableBatchedOperations                   : True
LockDuration                              : 00:01:00
MaxDeliveryCount                          : 10
MessageCount                              : 0
RequiresSession                           : False
Status                                    : Active
UpdatedAt                                 : 1/20/2017 3:18:54 AM

Creates the subscription SB-TopicSubscription-Example1 for the specified Service Bus topic SB-Topic_exampl1.

Parameters

-AutoDeleteOnIdle

Specifies the TimeSpan idle interval, after which the subscription is automatically deleted. The minimum duration is 5 minutes.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DeadLetteringOnFilterEvaluationExceptions

Value that indicates whether a subscription has dead letter support on filter evaluation exceptions.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DeadLetteringOnMessageExpiration

Dead Lettering On Message Expiration

Type:Nullable<T>[Boolean]
Accepted values:TRUE, FALSE
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-DefaultMessageTimeToLive

Timespan to live value. 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. For Standard = Timespan.Max and Basic = 14 dyas

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EnableBatchedOperations

Enable Batched Operations - value that indicates whether server-side batched operations are enabled

Type:Nullable<T>[Boolean]
Accepted values:TRUE, FALSE
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ForwardDeadLetteredMessagesTo

Queue/Topic name to forward the Dead Letter message

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ForwardTo

Queue/Topic name to forward the messages

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-LockDuration

Lock Duration

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-MaxDeliveryCount

MaxDeliveryCount - the maximum delivery count. A message is automatically deadlettered after this number of deliveries.

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Name

Subscription Name

Type:String
Aliases:SubscriptionName
Position:3
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Namespace

Namespace Name

Type:String
Aliases:NamespaceName
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-RequiresSession

RequiresSession - the value indicating if this queue requires duplicate detection.

Type:Nullable<T>[Boolean]
Accepted values:TRUE, FALSE
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group

Type:String
Aliases:ResourceGroup
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Topic

Topic Name

Type:String
Aliases:TopicName
Position:2
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Nullable<T>[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

Nullable<T>[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

Outputs

PSSubscriptionAttributes