Azure Function binding attributes - Database name setting - VS2017 preview tooling

Viewed 1223

I'm using the new tooling for Azure Functions projects in VS2017 Preview and have ported some functions from the Azure portal to the new projects.

I'm binding to an Azure Document DB - it's working fine, but when I use the DocumentDB attribute I have to supply the database name as the first parameter.

In my case it's the DEV database for now .. but of course there will be other environments - is there a way I can pick up the database name via an application setting for the function app?

[FunctionName("TimerTriggeredFunction")]
public static void Run([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer, TraceWriter log,
                       [DocumentDB("my-db-DEV", "MyCollection")]  IEnumerable<dynamic> inputDocuments)
2 Answers
Related