我已经使用Visual Studio创建了cosmosdb和Azure函数1.0。我在local.settings.json中添加了cosmosdb connectionstring和storageaccount密钥,但在cosmos中添加或修改时,我的azure函数未触发。
[FunctionName("Function1")]
public static void Run([CosmosDBTrigger(
databaseName: "cdb",
collectionName: "myc",
ConnectionStringSetting = "DBConnection",
LeaseCollectionName = "leases")]IReadOnlyList<Document> input,
TraceWriter log)
{
if (input != null && input.Count > 0)
{
log.LogInformation("Documents modified " + input.Count);
log.LogInformation("First document Id " + input[0].Id);
}
}
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "Storage account key",
"AzureWebJobsDashboard": "Storage account key",
"DBConnection": "Cosmos db connection string"
}
}