While writing a unit test for a class that created a Windows Azure Storage table, I named the test table “Test_Function_Date” where Function and Date where replaced with meaningful test information. The underscores in the table name were also there.
Azure CloudTableClient.CreateTableIfNotExist Exception
While running the test, my call to CloudTableClient.CreateTableIfNotExist(TableName) threw an exception.
Illegal Table Name Exception Details
The outer exception is Exception of type 'Microsoft.WindowsAzure.StorageClient.StorageClientException' was thrown. The inner exception is "An error occurred while processing this request." Buried in the inner exception XML is a status code of OutOfRangeInput, with a message of “One of the request inputs is out of range.” Since this was a single unit test with not much prep work, I figured out it was the table name.
Azure Table Name Rules
The rules for table naming allow:
- do not begin with a numeric
- case insensitive
- length from 3 to 63
Regular Expression for Azure Table Name Rules
The regular expression (provided by Neil Mackenzie) is:
So in the example table name of “Test_Function_Date”, the underscores were the problem.