Azure Blob 400 Bad request on Creation of container Azure Blob 400 Bad request on Creation of container azure azure

Azure Blob 400 Bad request on Creation of container


As you found through your research, the problem is the name.

You say that your test container is named imageads-57905553-8585-4d7c-8270-be9e611eda81, but in your code you are using ImageAds-57905553-8585-4d7c-8270-be9e611eda81. Notice the difference in capitalization. If you switch your container name to all lower case it will work correctly.


For more information, see #3 under Container Names at Naming and Referencing Containers, Blobs, and Metadata:

3. All letters in a container name must be lowercase.


To expand on @kwill's answer, I implemented a solution for converting any string into an acceptable container name, based on Azure's rules for container naming:

public static string ToURLSlug(this string s){    return Regex.Replace(s, @"[^a-z0-9]+", "-", RegexOptions.IgnoreCase)        .Trim(new char[] { '-' })        .ToLower();}

Then, when you try to get the container, clean it up first:

CloudBlobContainer container = blobClient.GetContainerReference(bucket.ToURLSlug());


I actually ended up finding the problem.

My problem was that the blob storage emulator would not start (the other emulators would start and I missed the blob). The problem ended up being that the port 10000 (default blob emulator port) was already being used by another software. I used Netstat cmd tool to see which software it was, killed it and its now working like a charm!!! Thanks everyone!!