TIP
💡 Learn more : Azure storage account overview.
In case you are new to the Azure Storage Tables, we've reviewed the following items so far:
If you've ever been working with Azure Table Storage and tried to insert data and received 400 Bad Request, then you've probably narrowed this down to a malformed PartitionKey or RowKey after many hours. This is due to the fact that for PartitionKey and RowKey, there are some disallowed characters such as:
Debugging in Visual Studio If you are debugging in Visual Studio, then you can also check the StorageException.RequestInformation.ExtendedInformation to gain additional information about the error.
There is many ways that you can handle this, but my favorite is this extension method that simply strips away those characters as shown below.
public static string ToAzureKeyString(this string str)
{
var sb = new StringBuilder();
foreach (var c in str
.Where(c => c != '/'
&& c != '\\'
&& c != '#'
&& c != '/'
&& c != '?'
&& !char.IsControl(c)))
sb.Append(c);
return sb.ToString();
}