Home > Sample chapters > Windows > Windows Server

Developing Cloud Applications with Windows Azure Storage: Blobs

Container and blob naming rules

You should be aware of several naming rules for blobs and their containers. A blob container name must be between 3 and 63 characters in length; start with a letter or number; and contain only letters, numbers, and the hyphen. All letters used in blob container names must be lowercase. Lowercase is required because using mixed-case letters in container names may be problematic. Locating trouble in a failing application related to the incorrect use of mixed-case letters might result in a lot of wasted time and endless amounts of frustration and confusion.

To make matters a bit confusing, blob names can use mixed-case letters. In fact, a blob name can contain any combination of characters as long as the reserved URL characters are properly escaped. The length of a blob name can range from as short as 1 character to as long as 1024 characters.

If you inadvertently violate any of these naming rules, you receive an HTTP 400 (Bad Request) error code from the data storage service, resulting in a StorageClientException being thrown if you are accessing blob storage using the Windows Azure software development kit (SDK).

You are not prohibited from using mixed casing in code, though, but some irregularities may adversely impact you when you do use it. For example, if you create a container properly in lowercase, but then later attempt to use that container in mixed-cased requests, your requests will all succeed because the mixed case container name is silently matched with the lowercase container name. This silent but menacing casing coercion can lead you to really scratch your head during debugging, so I strongly urge you to commit to memory the rule that blob container names must not contain uppercase letters.