azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Create CorrelationFilter Rule on ServiceBus Topic Subscription

Open clinsted opened this issue 6 years ago • 20 comments

This is autogenerated. Please review and update as needed.

Describe the bug

Trying to create a correlation filter rule (Label = xxx) on a topic subscription. The same was successfully created in C# using the SubscriptionClient.AddRuleAsync:

_subscriptionClient.AddRuleAsync(new RuleDescription() { Name = "Rule1", Filter = new CorrelationFilter { Label = "test" } }).GetAwaiter().GetResult();

Command Name az servicebus topic subscription rule create

Errors:

BadRequest - Value cannot be null.

Parameter name: sqlExpression CorrelationId: a9cf8052-c375-4235-aba4-3a153f9aaf33

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az servicebus topic subscription rule create --name {} --namespace-name {} --subscription-name {} --topic-name {} --resource-group {} --subscription {} --enable-action-preprocessing false --enable-correlation-preprocessing true --enable-sql-preprocessing false --label {}

Expected Behavior

Create a correlation filter rule, with a label filter.

Environment Summary

Windows-10-10.0.18362-SP0
Python 3.6.6

azure-cli 2.1.0

Extensions:
application-insights 0.1.3
interactive 0.4.3
storage-preview 0.2.10

Additional Context

Is this a bug or am I missing something in the az servicebus topic subscription rule create command?

Also tries specifying --filter-sql-expression but this creates a SqlFilter type rule.

clinsted avatar Feb 27 '20 07:02 clinsted

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl

ghost avatar Feb 27 '20 08:02 ghost

service bus

yungezz avatar Feb 27 '20 08:02 yungezz

Hi , any update on the fix for this bug?

sowmyaeerlapati avatar May 26 '20 12:05 sowmyaeerlapati

I also need to create correlation filter rules via the CLI. Any updates? Ths!

tomhundley avatar May 29 '20 14:05 tomhundley

@v-Ajnava , could you please take a look at this one?

nemakam avatar Jun 10 '20 00:06 nemakam

For some reason, it seems that the --filter-sql-expression parameter is required, even though it is marked as optional in the docs.

This seems to be a mistake in the Azure CLI implementation.

Here's the command handler: https://github.com/Azure/azure-cli/blob/8adf97355a605d147afc26f6c1b6f6afb6651c2f/src/azure-cli/azure/cli/command_modules/servicebus/custom.py#L326-L361

Here's the test for this command: https://github.com/Azure/azure-cli/blob/8adf97355a605d147afc26f6c1b6f6afb6651c2f/src/azure-cli/azure/cli/command_modules/servicebus/tests/latest/test_servicebus_commands.py#L376-L379

There's no test for running the command without the --filter-sql-expression parameter, which it sets to test=test

Here's the recorded request and response generated by the test: https://github.com/Azure/azure-cli/blob/6185cbbf0136ffb1ec12de3efdcc3136ec3c2235/src/azure-cli/azure/cli/command_modules/servicebus/tests/latest/recordings/test_sb_rules.yaml#L539-L599

LayZeeDK avatar Aug 28 '20 09:08 LayZeeDK

Internal Tracking devdivcsef 359125

scgbear avatar Nov 23 '20 19:11 scgbear

Are there any workarounds or do we just have to wait for a fix?

mossywell avatar Jan 14 '21 20:01 mossywell

Still no fix? That is really annoying

mildsar avatar Feb 18 '21 14:02 mildsar

is this issue still not fixed? seems the only way is to filter the correlation property using sql expression

adeliab avatar Jul 02 '21 15:07 adeliab

service bus team should look into this

yonzhan avatar Jul 02 '21 15:07 yonzhan

Looks like service bus team ignores this bug.

mildsar avatar Oct 25 '21 11:10 mildsar

I'm experiencing the same issue. I know the workaround is there using C# and REST, but this is not ideal for a company that it's using your services and expects manage infrastructure with AZ CLI the same one that it's promoted if you are an IT professional. Also, what is the point to study and pass certifications exams when in real life things you expected to work are actually broken. This affects the credibility of all IT professionals.

When can we wait for a fix on this? Please increase priority.

victor-chavez avatar Dec 19 '21 04:12 victor-chavez

Can you please allow us to create correlation filters through the CLI? Not much use encouraging correlation filters over sql expressions but then not giving us useful ways to implement it.

brian-duffy avatar Jan 30 '22 20:01 brian-duffy

Hi Team,

Sincere apologies for the delay in response here.

We will triage internally and get back to you with an update soon.

Saglodha avatar Feb 21 '22 14:02 Saglodha

Can we get an update please. This is a fairly critical issue considering how important correlation rules are for any kind of meaningful, performant, advanced routing in Azure ServiceBus via the az cli. This has been an issue for over 2 years now.

With this still broken it means we still need to use hacky workarounds in Azure Functions that first attempt to clear default rules and then add new rules each initialization via C# etc...

DanoThom avatar Mar 08 '22 16:03 DanoThom

Hi Team,

Thanks for your patience here. Our dev team has been working on coming up with a fix ( as I type this comment). With everything in place, I am positive that we should be able to roll out a fix for this one by this month's end ( rough estimate).

I would circle back with update soon.

Saglodha avatar Mar 09 '22 08:03 Saglodha

Hi Team,

I am here to share some good news!

We could fix this issue in the latest release (https://docs.microsoft.com/en-us/cli/azure/release-notes-azure-cli?view=azure-cli-latest#service-bus). Please try the rule creation at your side and let us know in case you observe any other discrepancies. Thanks

Saglodha avatar Apr 06 '22 07:04 Saglodha

Hi, thanks for getting back to us about the update. I've just tested this and I can finally confirm that this is now working. Here is the syntax I'm using: az servicebus topic subscription rule create -g rgtest --namespace-name sbtest --topic-name mytopicname --subscription-name mysubname -n mycorrelationfilterrulename --filter-type CorrelationFilter --label=mycorrelationfilterstring

DanoThom avatar Apr 08 '22 09:04 DanoThom

This is working as expected using the syntax by DanoThom.

@DanoThom thank you.

clinsted avatar Apr 11 '22 09:04 clinsted