1

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();
David Masters
  • 8,069
  • 2
  • 44
  • 75

2 Answers2

2

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.

tblanarik
  • 21
  • 2
1

I had this issue in the java SDK when i created the client like so:

new TableClientBuilder()   
        .endpoint("https://{storageAccountName}.table.core.windows.net/{tableName}")
                .sasToken(sas)
                .tableName(tableName)
                .buildClient()

So what i did wrong was putting the table name as part of the endpoint and removing it stopped the exception.

Ohad Bitton
  • 460
  • 2
  • 14