ServiceBusExplorer icon indicating copy to clipboard operation
ServiceBusExplorer copied to clipboard

Error when using SAS-policy and connection string with Service Bus Queue

Open AntonBarwald opened this issue 3 years ago • 7 comments

When I use RootManageSharedAccessKey for the Service Bus Namespace I can see everything, see below image

When creating a SAS policy (Manage, Send, Listen) on the queue only and connecting using the connection string:

  • <08:55:02> Failed to retrieve Service Bus topics. Exception: Microsoft.ServiceBus.Messaging.MessagingException: Cannot get entity 'my-queue' because it is not of type TopicDescription. Check that you are using method(s) with the correct entity type. ---> System.Runtime.Serialization.SerializationException: Error in line 1 position 2599. Expecting element 'TopicDescription' from namespace 'http://schemas.microsoft.com/netservices/2010/10/servicebus/connect'.. Encountered 'None' with name '', namespace ''.

  • <Error><Code>401</Code><Detail>User is not authorized. TrackingId:...-...</Detail></Error>

image

When creating a SAS policy (Manage, Send, Listen) on the topic and working with subscriptions it seems to work:

image

Anything that I might have missed when connecting to queues?

Thanks for assisting!

AntonBarwald avatar Dec 29 '21 08:12 AntonBarwald

For me it does not work with queues nor topics. There are at least two PRs that added/enhanced this funtionality, #375 and #562.

@rajrao and @avdv, does it work for you?

ErikMogensen avatar Dec 29 '21 16:12 ErikMogensen

Latest version 5.0.7 also has the same issue "User is not authorized" while using SAS-Policy in Queue, whereas only Topic Subscription works fine.

chandraatgithub avatar Apr 21 '22 16:04 chandraatgithub

Any news on this issue? We're facing the same problem.

cosminstirbu avatar Aug 22 '22 11:08 cosminstirbu

Based on my local debugging, it seems the issue is caused by the usage of ServiceBusHelper2 in HandleQueueControl and HandleTopicControl constructors.

Basically when you select a queue / topic with a entity level policy it attempts to use the ServiceBusAdministrationClient (via ServiceBusHelper2) (and it fails, as expected).

On my local machine, to simply work around this, I've commented the usage of ServiceBusHelper2 in HandleQueueControl, however I would defer to you for a long term solution, as I'm not familiar enough with the original intentions behind this design.

@ErikMogensen - tagging you since the issue is closed and I'm not sure this is on you radar.

cosminstirbu avatar Aug 23 '22 06:08 cosminstirbu

When testing this on the latest commit in the develop branch both connecting to a queue and a topic works for me but I do get tons of error messages in the log window.

Is it only the error messages that is the problem?

ErikMogensen avatar Aug 23 '22 19:08 ErikMogensen

It connects successfully, however if you select the topic/queue the view to the right of the tree view doesn't load, and an exception is logged.

cosminstirbu avatar Aug 23 '22 19:08 cosminstirbu

@ErikMogensen - not sure if you got the chance to look into this.

cosminstirbu avatar Sep 22 '22 11:09 cosminstirbu

@AntonBarwald, @chandraatgithub, @cosminstirbu Please test https://github.com/paolosalvatori/ServiceBusExplorer/releases/tag/5.0.15-preview and report back whether this issue is resolved or not. Please keep an eye out for issues regarding connecting.

ErikMogensen avatar Nov 12 '22 10:11 ErikMogensen

Tested the preview version and it fixed the issue. So far so good, didn't find any other issues, although my testing was rather limited.

Thank you!

cosminstirbu avatar Nov 16 '22 15:11 cosminstirbu

Happy to read that!

ErikMogensen avatar Nov 16 '22 21:11 ErikMogensen