miltoncamara miltoncamara - 9 months ago 55
C# Question

Bind CosmosDB Local Function

Bind Azure CosmosDB on Azure Functions running locally. Any configuration is required to use this feature?

using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using System.Collections.Generic;

namespace CDPCompare
public static class CallWS
public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, TraceWriter log, IEnumerable<dynamic> inputDocument)
foreach(var item in inputDocument)

Answer Source

Yes, configuration is required for your inputDocument argument.

You need to use this attribute to specify the Cosmos DB name and the collection.

[DocumentDB("%DatabaseName%", "MyCollection")] IEnumerable<dynamic> inputDocuments

To pick up that attribute you need to reference the NuGet package for document DB Microsoft.Azure.WebJobs.Extensions.DocumentDB. Last I checked this NuGet package is still in pre-release so make sure you include that when searching for the package.

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download