4
votes

This question is related to: Using Azure Service Bus in java - a previous question that concerned using the ACS connection information to get a ServiceBusContract.

My question is different because I am trying to do this using the SAS connection information obtained from the Azure portal - e.g. SAS information similar to the following:

NAME RootManageSharedAccessKey

CONNECTION STRING Endpoint=sb://jasper.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=x/H5HHhht00H5hH5pHHHhhHh5hHhH5HhHhhhLh5hhHH5=

Is there another method analogous to configureWithWrapAuthentication that can be used to obtain a ServiceBusContract from the SAS information?

The Windows Azure SDK 2.0 Release (April 2013) can authenticate to Windows Azure Service Bus using either Shared Access Signature (SAS) authentication or through the Windows Azure Active Directory Access Control. However, I didn’t find this example in C# helpful in my case because I want to do this in Java code and because I obtain the SAS connection from the Azure portal.

EDIT:

I believe this question is on-topic and should not be closed because a similar SO question was answered (cited above.) That question was resolved because the parameters used by the method configureWithWrapAuthentication had changed, and were not documented.

Using that answer I created a service bus namespace and succeeded in programmatically creating a ServiceBusContract using the default ACS connection information obtained from the portal, like this:

String namespace = "jasper";
String issuer = "owner";
String key = "<acs key obtained from portal>";
String serviceBusRootUri = ".servicebus.windows.net";
String wrapRootUri = “-sb.accesscontrol.windows.net/WRAPv0.9”;
Configuration config = 
ServiceBusConfiguration.configureWithWrapAuthentication(
    namespace,
    issuer,
    key,
    serviceBusRootUri,
    wrapRootUri);  
ServiceBusContract service = ServiceBusService.create(config);

The portal provides two sets of connection information: 1) a set that can be used to configure the namespace with ACS, and 2) an alternative set (key and name) that is labeled as for SAS (shared access signature).

My question is how or if it is possible to use the SAS key and endpoint displayed by the portal to connect programmatically to my service bus namespace. The code above failed to work with the SAS key. Can this even be done with SAS using the configureWithWrapAuthentication method? Is there any other information about this method's parameters that I could use to accomplish this?

thank you

1

1 Answers

3
votes

SAS for service bus is something that would likely be added in a future Java SDK. At this time, SAS authorization and SAS connections strings are only supported by the .NET client library.