Unauthorized-access Exception


I am trying to connect to a subscription and receive a message, however I keep receiving an unauthorized-access exception. I have tried using both SAS and ACS names/keys but the exception is thrown no matter what. I do encode the key before putting it in the address string. So here are the values I am using to connect:

Address String: "amqps://owner:{key}{at}telemsandbox.servicebus.windows.net"

Receiver Name : "receive-link/{topic}/Subscriptions/{subscription}"

Receiver Address : "{topic}/Subscriptions/{subscription}"

Any ideas on what could be causing this issue?
Closed Sep 1, 2015 at 1:14 AM by xinchen


ppatierno wrote Jun 17, 2014 at 7:03 PM

Just to be sure...

The {key} must be URL encoded. You have to get it from Azure management portal and then use a tool to URL encode it to use in the address string. You can use it :


Have you executed URL encoding ?

Paolo Patierno

houstonputman wrote Jun 17, 2014 at 7:12 PM

Yes, the key is encoded. And it looks like I also get the error if I try to send a message to the topic.

ppatierno wrote Jun 17, 2014 at 8:18 PM

Did you try if it works on a simple queue ?

ppatierno wrote Jun 17, 2014 at 8:41 PM

I tried the simple TestMethod_ReceiveWaiter with following sending to "t1" topic and receiving from "t1/Subscriptions/s1" subscription and all works fine.

Can you put your code here ?

xinchen wrote Jun 17, 2014 at 9:20 PM

Can you create the Address object using the other ctor (that takes individual parameters)? You do not need to URL encode any of them with that one. Just want to make sure that it is not some issue in the parser.



houstonputman wrote Jun 17, 2014 at 9:31 PM

Using the other constructor fixed everything.


ppatierno wrote Jun 18, 2014 at 3:57 AM

As Xin Chen said ... there is a bug inside address parser.

It could be useful ...

Have the key so we can debug the parser and find the issue or you can debug the parser and tell here what is the problem.


ppatierno wrote Jun 18, 2014 at 4:11 AM

You can just see after creating Address object if the field related to the key is correct.
If you can post here the key, then you can regenerate it to avoid external access.
It is needed only to see where te parser fails.

xinchen wrote Jun 27, 2014 at 6:51 AM

Please reopen this issue if you find it is caused by a bug in the address parser.

Thank you.


houstonputman wrote Jun 30, 2014 at 7:18 PM

I am pretty sure that I was just using old code. When I updated to the latest commit I was able to open a connection using both Address constructors.