使用 Azure 函数中的 Cosmos DB table API

Using Cosmos DB table API from Azure function

我正在尝试通过 Azure 函数使用 Cosmos DB table API。使用 local.settings.json 文件我能够读取连接字符串并解析 它像我习惯的那样成功:

local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
      "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=MYSTORAGEACCOUNT;AccountKey=AUTHKEY;TableEndpoint=https://COSMODB.documents.azure.com"
   }
}

正在发起连接:

var storageAccount = CloudStorageAccount.Parse(ConnectionString);
var tableClient = storageAccount.CreateCloudTableClient();
var table = tableClient.GetTableReference("users");

调用

之后问题就来了
table.CreateIfNotExists();

这个 returns 一个 http 错误 400,内部异常也是一个 http 错误 400,没有进一步的解释。看起来我需要设置一些额外设置的 Cosmos DB 示例,可能至少是这样的:

<configuration>
   <appSettings>
     <!--Table creation options -->
     <add key="TableThroughput" value="700"/>
   </appSettings>
</configuration>

如何在代码或 local.settings.json 文件中设置它们以便在 Azure 函数中使用它们?还是我走错方向了?

我们目前不支持从 Azure Functions 与 Table API 对话。它在我们的路线图上。