Tuesday, October 26, 2010

AZURE: Error: (400) Bad Request

Have you been playing with Azure storage, trying to create Blobs, Tables or Queue’s ??

Have you been getting any of the following errors:

[Azure Blob Storage]
Microsoft.WindowsAzure.StorageClient.CloudBlobClient ccb = account.CreateCloudBlobClient();
CloudBlob cb = ccb.GetBlobReference("myblob2871618");

FAILS with: StorageClientExecption
"One of the request inputs is out of range."
"The remote server returned an error: (400) Bad Request."
Error code: BadRequest

[Azure Table Storage]
Microsoft.WindowsAzure.StorageClient.CloudTableClient cct = account.CreateCloudTableClient();
"Exception of type 'Microsoft.WindowsAzure.StorageClient.StorageClientException' was thrown."
StatusCode: System.Net.HttpStatusCode.BadRequest

[Azure Queue Storage]
Microsoft.WindowsAzure.StorageClient.CloudQueueClient ccq = account.CreateCloudQueueClient();
CloudQueue cq = ccq.GetQueueReference("myqueue");

"One of the request inputs is out of range."
"The remote server returned an error: (400) Bad Request."

Well, the solution is as I found a little simpler than imagined.

When I created my Storage account online I created it with my standard Camel Case name. PaulStorage. On my connection string I had the name of the storage and my key.

So it looked like:


When you try and open the connection for my Cloud Storage Account, and pass this in, it will work fine, when you try and do anything like the statements above you get the errors listed.

I knew that for other things like Queue’s in Azure you need to specify them in lowercase or they don’t work. I asked around and found that Azure was very fussy when it came to case. Even though I had specified the Storage account as Camel case I needed to pass it in as lower case to have it work:


Once I made this remarkable at the time, discovery.. Everything started working.

One thing to note is that development storage is a lot more forgiving and you don’t have to worry about any of this.

Development storages connection string is as simple as it gets:



Paul Somers Connected Systems Blog said...

If this solved your problem leave a comment here. Quite a few people seem to have come accross this problem.

2Dogs said...

Arrgghhh!!! this bit me too. I spent hours on this. Can't believe it still isn't fixed in the 2.0.3 SDK

Satyam Sharma said...

Make sure that container should also be lower case when we are using function CreateIfNotExists.

here is code snippet

var cloudAccount = v.CloudStorageAccount.Parse(

var cloudBlobClient = cloudAccount.CreateCloudBlobClient();
var container = cloudBlobClient.GetContainerReference(type.ToLower());
var blobObject = container.GetBlockBlobReference(filename);
return blobObject;