WindowsAzure.Storage vs. Azure.Data.Tables binding in a Http Trigger function

adriana_malea 141 Reputation points


Can you please explain me what is the correct way to use Storage libs in the context of deprecated / non-deprecated?

  1. If I am using

Microsoft.Azure.WebJobs.Extensions.Storage Version="4.0.4"
"Microsoft.NET.Sdk.Functions Version="3.0.13"

and the following code:

using Microsoft.WindowsAzure.Storage.Table;
        public static async Task<HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestMessage req,
            [DurableClientAttribute] IDurableOrchestrationClient client,
            [Table("ZPGCallouts")] Microsoft.WindowsAzure.Storage.Table.CloudTable cloudTable)

When starting the function, it throws:

Microsoft.Azure.WebJobs.Host: Error indexing method 'SubscriptionProvisioningCalloutFunction'. Microsoft.Azure.WebJobs.Extensions.Storage: Can't bind Table to type 'Microsoft.WindowsAzure.Storage.Table.CloudTable'

I don't have a CosmosDB in my project, so I am not confident that using Microsoft.Azure.Cosmos.Table instead of WindowsAzure.Storage.Table is the solution.

  1. I have tried with Azure.Data.Tables
    I have the following model entity that implements Azure.Data.Tables.ITableEntity, instead of inheriting from Microsoft.WindowsAzure.Storage.Table.TableEntity public class CalloutEntity : ITableEntity
    public CalloutEntity() {}
        public CalloutEntity(CalloutData data)
            if (data == null) return;
            Id = data.Id;
            PartitionKey = "TestCallout";
            RowKey = Guid.NewGuid().ToString("N");
            Timestamp = DateTimeOffset.UtcNow;
        public Guid Id { get; set; }
        public string PartitionKey { get; set; }
        public string RowKey { get; set; }
        public DateTimeOffset? Timestamp { get; set; }
        public ETag ETag { get; set; }

and I also have a trigger function, that used to bind a Microsoft.WindowsAzure.Storage.Table.CloudTable (see code above at 1.)

Which class from which lib should I bind now? I can't use CosmosDB.CloudTable, because I am not using the ComosDB service.
I need a class that knows like CloudTable to use the connection string from AzureWebJobsStorage.

Thanks for the clarifications!

Azure Table Storage
Azure Table Storage
An Azure service that stores structured NoSQL data in the cloud.
158 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,356 questions
0 comments No comments
{count} vote

Accepted answer
  1. Pramod Valavala 20,591 Reputation points Microsoft Employee

    @adriana_malea The Microsoft.Azure.Cosmos.Table SDK implements the Table API which both Azure Storage Tables and Azure CosmosDB Table API support. The SDK adapts based on the service connecting to. Therefore the Microsoft.Azure.WebJobs.Extensions.Storage SDK references Microsoft.Azure.Cosmos.Table instead.

0 additional answers

Sort by: Most helpful