How to fetch the details of Service Bus Queue using shared access policy (Without Manage Option) connection string?

Sandhiya Sivakumar 21 Reputation points
2021-12-29T10:44:00.237+00:00

I have used WindowsAzure.ServiceBus v5 package to access service bus queue details by specifying the SAP connection string and queue name. When the SAP has Send, Listen access but not the Manage Claim option, If I try to check whether the queue exits or not in the service bus it throws the below exception

Exception: AzureServiceBusQueue: Exception raised while checking for the availability of the configured queue: The remote server returned an error: (401) Unauthorized. Manage,EntityRead claims required for this operation.

Code I have used:

var servicebusConnectionString = new ServiceBusConnectionStringBuilder(connectionString)
                {
                    TransportType = TransportType.Amqp
                };
NamespaceManager namespaceManager = NamespaceManager.CreateFromConnectionString(servicebusConnectionString.ToString());
if (namespaceManager.QueueExists(path))
    return true;

Where as If I try the same with SAP connection string that have the access to Manage, I could get the queue details.

Here I am just trying to access/read the details of the queue not going to manage the entity but still, Why I need the Manage operation access?. Is there any solution to overcome this?

Note: In Service Bus Explorer also couldn't get the queue/topic details if its key doesn't have the Manage option.

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
617 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 70,226 Reputation points
    2022-01-03T06:21:09.59+00:00

    @Sandhiya Sivakumar If you want to use SAS then you need to use Manage access to Get the queue description, Enumerate queues, etc. as mentioned in Right required for Service Bus Operation document. If you are using SAS then you should have Manage access to get the queue/topic/subscription properties or verify if the queue exists etc.
    Service bus explorer needs the manage access at the namespace level as there are multiple operations like listing queue/subscription etc that can only be performed using managed access.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.