0
votes

I created a shared access policy with only send permission for a service bus queue. I used to send messages from web role to service bus queue using service bus connection string. Now the requirement is , instead of using service bus connection string I need to create a shared policy for service bus Queue with only send permission and use that policy for sending messages to service bus from web role.

I need to do this in c#, but I do not know how to create connection string for service bus queue with shared access policy. Kindly explain how to get Service bus Queue Shared access policy connection string in c#.

2

2 Answers

1
votes

When you add a policy at queue level, you could use the Service Bus connection string like below:

Endpoint=sb://configpoc.servicebus.windows.net/;SharedAccessKeyName=QueueListenOnlyPolicy;SharedAccessKey=<YourKey>

Here "QueueListenOnlyPolicy" will be the key of your Queue level policy.

Regards

0
votes

I am experiencing the same issue. When I generate SAS from the Queue level, I create a QueueClient (I tried with MessageSender as well), and it is OK, until I try to send a message. Then I get an authorization level. On the contrary, the namespace's connection string allows me to send the message. Both connection strings give the same rights.