|
2 | 2 | title: Set subscriptions filters in Azure Service Bus | Microsoft Docs
|
3 | 3 | description: This article provides examples for defining filters and actions on Azure Service Bus topic subscriptions.
|
4 | 4 | ms.topic: how-to
|
5 |
| -ms.date: 02/23/2024 |
| 5 | +ms.date: 07/18/2024 |
6 | 6 | ms.devlang: csharp
|
7 | 7 | ms.custom: devx-track-dotnet
|
8 | 8 | ---
|
9 | 9 |
|
10 | 10 | # Set subscription filters (Azure Service Bus)
|
11 | 11 | 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).
|
12 | 12 |
|
| 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 | + |
13 | 31 | ## Filter on system properties
|
14 | 32 | To refer to a system property in a filter, use the following format: `sys.<system-property-name>`.
|
15 | 33 |
|
@@ -111,7 +129,7 @@ Here's a .NET C# example that creates the following Service Bus entities:
|
111 | 129 | - Subscription named `ColorRed` with a SQL filter expression `color='red'` and an action
|
112 | 130 | - Subscription named `HighPriorityRedOrders` with a correlation filter expression `Subject = "red", CorrelationId = "high"`
|
113 | 131 |
|
114 |
| -See the inline code comments for more details. |
| 132 | +For more information, see the inline code comments. |
115 | 133 |
|
116 | 134 | ```csharp
|
117 | 135 | namespace CreateTopicsAndSubscriptionsWithFilters
|
@@ -365,7 +383,7 @@ See the following samples:
|
365 | 383 | - [Azure Resource Manager template](/azure/templates/microsoft.servicebus/2017-04-01/namespaces/topics/subscriptions/rules)
|
366 | 384 |
|
367 | 385 |
|
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. |
369 | 387 |
|
370 | 388 | - [Azure Service Bus client library samples for .NET (latest)](/samples/azure/azure-sdk-for-net/azuremessagingservicebus-samples/)
|
371 | 389 | - [Azure Service Bus client library samples for Java (latest)](/samples/azure/azure-sdk-for-java/servicebus-samples/)
|
|
0 commit comments