Skip to content

Commit 1a1a8fa

Browse files
Merge pull request #281237 from spelluru/sbusfilters0718
Set filters using Portal, PowerShell, or CLI
2 parents 34fd2b4 + 1e348f0 commit 1a1a8fa

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed
61.7 KB
Loading

articles/service-bus-messaging/service-bus-filter-examples.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,32 @@
22
title: Set subscriptions filters in Azure Service Bus | Microsoft Docs
33
description: This article provides examples for defining filters and actions on Azure Service Bus topic subscriptions.
44
ms.topic: how-to
5-
ms.date: 02/23/2024
5+
ms.date: 07/18/2024
66
ms.devlang: csharp
77
ms.custom: devx-track-dotnet
88
---
99

1010
# Set subscription filters (Azure Service Bus)
1111
This article provides a few examples on setting filters on subscriptions for Service Bus topics. For conceptual information about filters, see [Filters](topic-filters.md).
1212

13+
## Use Azure portal
14+
15+
To set subscription filters in the Azure portal, use the **Filters** section of the **Service Bus Subscription** page.
16+
17+
:::image type="content" source="./media/service-bus-filter-examples/filters-section.png" alt-text="Screenshot that shows the Service Bus Subscription page with the Filters section highlighted." lightbox="./media/service-bus-filter-examples/filters-section.png":::
18+
19+
## Use Azure CLI
20+
21+
Use the [`az servicebus topic subscription rule create`](/cli/azure/servicebus/topic/subscription/rule) to create a rule or filter on a subscription.
22+
23+
## Use Azure PowerShell
24+
25+
Use the [`Set-AzServiceBusRule`](/powershell/module/az.servicebus/set-azservicebusrule) to create a rule or filter on a subscription.
26+
27+
> [!NOTE]
28+
> A subscription rule consists of filters and actions. You can specify actions using CLI and PowerShell, but not using the Azure portal.
29+
30+
1331
## Filter on system properties
1432
To refer to a system property in a filter, use the following format: `sys.<system-property-name>`.
1533

@@ -111,7 +129,7 @@ Here's a .NET C# example that creates the following Service Bus entities:
111129
- Subscription named `ColorRed` with a SQL filter expression `color='red'` and an action
112130
- Subscription named `HighPriorityRedOrders` with a correlation filter expression `Subject = "red", CorrelationId = "high"`
113131

114-
See the inline code comments for more details.
132+
For more information, see the inline code comments.
115133

116134
```csharp
117135
namespace CreateTopicsAndSubscriptionsWithFilters
@@ -365,7 +383,7 @@ See the following samples:
365383
- [Azure Resource Manager template](/azure/templates/microsoft.servicebus/2017-04-01/namespaces/topics/subscriptions/rules)
366384

367385

368-
Try the samples in the language of your choice to explore Azure Service Bus features.
386+
To explore Azure Service Bus features, try the samples in the language of your choice.
369387

370388
- [Azure Service Bus client library samples for .NET (latest)](/samples/azure/azure-sdk-for-net/azuremessagingservicebus-samples/)
371389
- [Azure Service Bus client library samples for Java (latest)](/samples/azure/azure-sdk-for-java/servicebus-samples/)

0 commit comments

Comments
 (0)