1
votes

Reviewing the current options for CosmosDB (How to populate a CosmosDB collection by command line?) to prepopulate some Collections in CosmosDB, the unique alternative that I see, is the creation of an Azure Function and later disable it.

Using @TimerTrigger is possible to run a logic once? Or it is better to use @HttpTrigger?

What is your opinion?

Juan Antonio

1
If it's really only going to run once, why go through the hassle of having it be an Azure Function? And if you want it to be a Function because of, for instance, bindings, run it once from the CI/CD pipeline instead of publishing it and running it once from there.rickvdbosch
^^^ Exactly my point!Sajeetharan
Maybe another solution could be this one: docs.microsoft.com/en-us/rest/api/cosmos-db/…jabrena

1 Answers

2
votes

The two are indeed very similar. The main difference is the way in which they are triggered, HTTP request vs a timer.

If you only want to execute an Azure function once, you should use an HttpTrigger function.

TimerTrigger functions are designed to offer the user the possibility of configuring their application to run every so often, which is not your use case.