Microsoft.WindowsAzure.Storage.StorageException: Unexpected response code for operation ....

At times you would get errors such as below while executing batch transactions on a table in table storage

 Microsoft.WindowsAzure.Storage.StorageException: Unexpected response code for operation : 5
    at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](StorageCommandBase`1 cmd, IRetryPolicy policy, OperationContext operationContext)
    at Microsoft.WindowsAzure.Storage.Table.CloudTable.ExecuteBatch(TableBatchOperation batch, TableRequestOptions requestOptions, OperationContext operationContext)
    at Worker.Processors.QueueOneProcessor.FlushCache()
 Request Information
 RequestID:fe0a42c7-faeb-4fd7-a9f8-690bc12e1f41
 RequestDate:Tue, 21 May 2013 13:48:55 GMT
 StatusMessage:Accepted
 ErrorCode:OutOfRangeInput

One of the most common reason of such failure is malformed parameters passed in the query such as using disallowed characters in partitionkey or rowkey. The reason for the error above is that partitionkey contained a disallowed character "?". Refer to https://msdn.microsoft.com/en-us/library/dd179338.aspx  which specifies below

 

 Characters Disallowed in Key Fields
The following characters are not allowed in values for the PartitionKey and RowKey properties:

 • The forward slash (/) character
 • The backslash (\) character
 • The number sign (#) character
 • The question mark (?) character

If you are getting the aforementioned error then please check if the partitionkey or rowkey being passed contains a disallowed character and rectify it.