Manuel F.
Manuel F.

Reputation: 113

"400 Error: Bad request" Azure Storage Connection

When I create a C# Window Form Application and i put in main the following istructions i receive the "400 error: Bad Request"

CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1");
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("test");
container.CreateIfNotExists();

Upvotes: 1

Views: 1279

Answers (2)

Zhiliang
Zhiliang

Reputation: 172

If you are using Storage Client library version 6.0.0, you can upgrade storage emulator to version 4.2 or above. It is available as part of Azure SDK 2.7.1 for .NET.

https://azure.microsoft.com/en-us/blog/announcing-the-azure-sdk-2-7-1-for-net/

Upvotes: 3

Gaurav Mantri
Gaurav Mantri

Reputation: 136146

You will get this error if you're using Storage Client library version 6.0.0 with Storage Emulator as current version of Storage Emulator is not compatible with the latest version of Storage Client library.

You could do 2 things:

  1. Use older version of storage client library e.g. https://www.nuget.org/packages/WindowsAzure.Storage/5.0.2.
  2. Use a Cloud Storage Account instead of development storage account.

Upvotes: 1

Related Questions