我想从Document DB的Azure Function触发器创建表。但它总是给出错误“远程服务器返回错误:(400)错误请求。”任何人都可以帮助解决这个问题吗?
#r "Microsoft.Azure.Documents.Client"
using System.Diagnostics;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
using Microsoft.Azure.Documents;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System;
using System.Net;
public static async Task Run(IReadOnlyList<Document> input, TraceWriter log)
{
string connectionString = "<connection string copied from portal>";
try
{
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference("testtable");
bool f = table.CreateIfNotExists();
}
catch (StorageException e)
{
log.Info(e.InnerException.Message);
}
}
function.json
{
{
"bindings": [{
"type": "cosmosDBTrigger",
"name": "input",
"direction": "in",
"leaseCollectionName": "leases",
"connectionStringSetting": "personsTrigger_ConnectionString",
"databaseName": "document-temp",
"collectionName": "persons",
"createLeaseCollectionIfNotExists": true
}]
}
}