Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Table Storage - 501 Not Implemented

I'm following this guide for using Azure Tables: https://learn.microsoft.com/en-us/dotnet/api/overview/azure/data.tables-readme-pre which uses the Azure.Data.Tables NuGet package.

I can successfully save a row and see it in the storage explorer within the Azure portal, however when trying to do a simple query, I'm getting back:

Unhandled exception. Azure.RequestFailedException: Service request failed.
Status: 501 (Not Implemented)

Content:
{"odata.error":{"code":"NotImplemented","message":{"lang":"en-US","value":"The requested operation is not implemented on the specified resource.\nRequestId:0137da3a-f002-0031-19
d6-5234ab000000\nTime:2021-05-27T08:59:39.8919922Z"}}}

My code for the query is:

    var entities = _tableClient
        .Query<TableEntity>(t => t.PartitionKey == PartitionKey)
        .ToList();
like image 359
David Masters Avatar asked Oct 23 '25 05:10

David Masters


1 Answers

I ran in to this exact problem as well, and although it doesn't seem to be documented anywhere, the following worked for me:

var token = new DefaultAzureCredential();
var tableServiceClient = new TableServiceClient(new Uri($"https://{storageAccountName}.table.core.windows.net/"), token);
var client = tableServiceClient.GetTableClient(tableName);
var entities = client.Query<MyEntity>(filter: $"PartitionKey eq '{partKey}'");

I don't exactly understand why the direct creation of TableClient:

new TableClient(new Uri($"https://{storageAccountName}.table.core.windows.net/{tableName}"), tableName, token);

doesn't work, but going through TableServiceClient first worked for me. Give that a try.

like image 76
tblanarik Avatar answered Oct 25 '25 23:10

tblanarik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!