Deryn Johnstone

Deryn Johnstone

  • NA
  • 35
  • 1.1k

Azure table does not exist error when running Emulator

Jul 4 2022 4:41 AM

I am receiving this error when connecting my Table Storage when running my Azure function app. I have a Table Storage DB in Azure and also trying to run it through the emulator

DIConfig.cs to register services & prepare the TableServiceClient

using Azure.Data.Tables;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Template.Infrastructure;

public static class DIConfig
{
    public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
    {
        var tableClientConnectionString = configuration["AzureFunctionsJobHost:connectionStrings:tableStorage"];

        services.AddScoped(_ => new TableServiceClient(tableClientConnectionString));
        services.AddScoped(typeof(IRepository<>), typeof(TableClientRepository<>));

        return services;
    }
}

Host.JSON

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "connectionStrings": {
    "tableStorage": "UseDevelopmentStorage=true"
  }
}