0

I am working my way through a great tutorial on using Azure PaaS and have come up with a question. Here is the tutorial if it helps anybody else (been pretty useful for me) https://youtu.be/ScJ4VxOmNGs

Is there a way outside of writing a C# program to check what filters are set on a Service Bus Topic Subscription Rule?

I can do this:

var rules = await processPaymentInventoryCheckedClient.GetRulesAsync();

And access them that way, but is there a way using CLI or Powershell? I know that as of the date of this post you cannot do it in the portal.

I tried using Service Bus Explorer, and it shows the rule but not the filter: service bus filter missing

SBE is awesome btw, very helpful if you have not used it: https://github.com/paolosalvatori/ServiceBusExplorer

If I run the above C# code and then drill down into the properties I can verify that the filter is indeed applied:

enter image description here

Thank you --

Joe

Joe Ruder
  • 2,122
  • 2
  • 23
  • 52
  • If you're looking for an alternate tool to view the rules, may I suggest you take a look at Cerebrata Cerulean (https://www.cerebrata.com/products/cerulean). It has support for viewing and managing the same. https://i.stack.imgur.com/CgoM1.png [Full Disclosure: I am part of the team behind this tool]. – Gaurav Mantri Mar 24 '18 at 13:08
  • Thanks Gaurav -- I will give the trail a try. Tools to manage Azure are helpful. I am still wanting to know if there is a way from a command line of some type. – Joe Ruder Mar 24 '18 at 14:13
  • Thanks! I did look briefly at the available Cmdlets and based on my limited search I was not able to find anything. – Gaurav Mantri Mar 24 '18 at 14:14

1 Answers1

1

Regarding ServiceBus Explorer - it's a bug. The tool currently only shows SqlFilters and not CorrelationFilters. I've raised an issue to add support for CorrelationFilters.

To list all filter you can use the following LinqPad script with a free version of the tool:

var connectionString = "<asb-connection-string>";
var topicPath = "<topic-path>";
var subName = "<subscription-name>";
var nsm = NamespaceManager.CreateFromConnectionString(connectionString);

foreach (RuleDescription rule in await nsm.GetRulesAsync(topicPath,subName))
{
  if (rule.Filter is SqlFilter)
  {
    $"Rule: Name = {rule.Name} - 
        SqlExpression = {(rule.Filter as SqlFilter).SqlExpression}".Dump();
  }

  if (rule.Filter is CorrelationFilter)
  {
    $"Rule: Name = {rule.Name} - Correlate = {(rule.Filter as
        CorrelationFilter)}".Dump();
  }
}
Sean Feldman
  • 23,443
  • 7
  • 55
  • 80
  • Thanks Sean...I was hoping for CLI but that will help. – Joe Ruder Mar 24 '18 at 20:01
  • I'm in the mids of fixing this issue with SBE. Stay tuned. – Sean Feldman Mar 24 '18 at 20:06
  • @JoeRuder the fix for SBE is pending and will be released in version 4.0.109. If you need it already, you can pull down [my PR](https://github.com/paolosalvatori/ServiceBusExplorer/pull/201), compile it and use. This is what it will look like: https://imgur.com/a/qz2aI – Sean Feldman Mar 24 '18 at 20:13