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();
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With