Trigger Azure Function on Cosmos DB only by Update

Mikhail Delly 126 Reputation points
2023-06-13T08:14:40.06+00:00

Azure function triggered by Cosmos DB works on Update & Create operations.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-cosmos-db-triggered-function

Is this any possibility for AF to be triggered only by Update operations, not by Insert

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,899 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,895 questions
0 comments No comments
{count} votes

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,431 Reputation points Moderator
    2023-06-13T14:52:17.2666667+00:00

    Mikhail Delly Thanks for posting your question in Microsoft Q&A. Cosmos DB Trigger in Azure Functions uses Azure Cosmos DB change feed to listen for both inserts and updates. Reviewing the doc Change feed modes, there are two modes: Latest version mode and All versions and deletes mode and both of them process the changes for Insert as well (also Azure Function uses Latest version mode).

    Unfortunately, there is no way to process change feeds only for updates not Insert (no difference between insert and update discussion). Refer docs Azure Cosmos DB trigger for Azure Functions and Serverless event-based architectures with Azure Cosmos DB and Azure Functions for more info about usage.

    Similar discussion - see if you can utilize last modified timestamp to process it accordingly. I hope this helps and let me know if you have any questions.


    If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.