There's more...

When you integrate Azure Functions to track Cosmos DB changes, it will automatically create a new collection named leases, as shown in the following screenshot. Be aware that this is an additional cost as the cost in Cosmos DB is based on the request units (RUs) that are allocated for each collection:

It's important to note that the Cosmos DB trigger won't be triggered (at the time of writing) for any deletes in the collection. It is only triggered for create and updates to documents in a collection. If it is important for you to track deletes, then you need to do soft deletes, which means setting an attribute such as isDeleted to true for records that are deleted by the application and, based on the value of the isDeleted attribute, implementing your custom logic in the Cosmos DB trigger.

The integration that we have done between Azure Functions and Cosmos DB uses Cosmos DB change feeds. You can learn more about change feeds at https://docs.microsoft.com/en-us/azure/cosmos-db/change-feed.

Don't forget to delete the Cosmos DB account and its associated collections if you think you won't use them anymore, because the collections are charged based on the RUs allocated, even if you are not actively using them.

If you are not able to run this Azure Function or you get error saying that the Cosmos DB extensions are not installed, then try creating a new Azure Cosmos DB trigger, which should then prompt installation.