0

I am trying to create a filter SQL expression for Azure Service Bus Topics via Azure CLI. My filter expression has a special character (':'). When using the cli to create the filter I always receive a BadRequest response. The documentation for Service Bus mentions that the special characters need to be put into double quotes ". Therefore I try this: az servicebus topic subscription rule create --resource-group resourceGroup --namespace-name servicebus --topic-name myTopic --subscription-name mySubscription --name filterName --filter-sql-expression "cloudEvents:type"='typeName:v1'

The error response I receive: BadRequestError: BadRequest: There was an error parsing the SQL expression. [Token line=1, column=11, Token in error= :, Additional details= Unrecognized character. ':']

I've tried to use it without the quotes, I tried to put everything in double quotes. I don't get it to work. Does anyone know how to fix that or is it simply not supported?

Vegi
  • 77
  • 6
  • Does this answer your question? [Azure ServiceBus SqlFilter Expression Syntax error](https://stackoverflow.com/questions/45786191/azure-servicebus-sqlfilter-expression-syntax-error) – Ecstasy Jun 14 '22 at 12:23
  • [How to add filters to Topic's subscription in Azure Service Bus](https://stackoverflow.com/questions/51039545/how-to-add-filters-to-topics-subscription-in-azure-service-bus) – Ecstasy Jun 14 '22 at 12:30
  • thanks for your answer. It didn't work with the provided proposal. However, I was able to find the solution based on your links and some CLI documentation. – Vegi Jun 14 '22 at 13:04

1 Answers1

0

I was able to find the solution. The trick is to have the argument in double quotes and then surround the actual value into double double quotes, indicating to add them:

--filter-sql-expression """cloudEvents:type""='typeName:v1'"

Vegi
  • 77
  • 6