1
votes

The following call

CloudStorageAccount.Parse(<connection-string>);

returns this error:

"No valid combination of account information found."

with the connection string copied directly from the CONNECTION STRING–PRIMARY KEY field on the Azure service Bus Access Policies -> Policy blade, which looks like this:

Endpoint=sb://xxx.servicebus.windows.net/;SharedAccessKeyName=xxx;SharedAccessKey=xxx;EntityPath=xxx

I need CloudQueueClient and CloudQueue instances to do queue manipulation. Am I missing something obvious, or is there another way to initialise CloudStorageAccount?

Update: the following syntax allows me to add a new queue using the service level (not queue level) credentials, but I'm not sure how I get from here to a CloudQueue or CloudQueueClient instance.

var queueNamespace = NamespaceManager.CreateFromConnectionString(
     "Endpoint=sb://<service-account>.servicebus.windows.net/;
     SharedAccessKeyName=sharedaccess;
     SharedAccessKey=xxx");
1

1 Answers

3
votes

The reason you're getting this error is because you're trying to use storage client library for Service Bus resources. Microsoft.WindowsAzure.Storage is the client library for Azure Storage. Queues in Azure Storage are not a Service Bus Queues.

For Service Bus queues you would need to use its client library that you can install via Nuget from https://www.nuget.org/packages/WindowsAzure.ServiceBus/.

Once you do that, you should be able to create a NamespaceManager using the following code:

var manager = Microsoft.ServiceBus.NamespaceManager.CreateFromConnectionString(ConnectionString);

and then you will be able to perform operations on your Service Bus Queues.

You may find this link useful as well: https://azure.microsoft.com/en-in/documentation/articles/service-bus-dotnet-get-started-with-queues/.