Write Stateless and Idempotent Functions
Azure Functions have an event-driven programming model, and functions can run stateless and stateful.
For instance, when orders are picked up from a service bus, the function handles it and pushes it to a Cosmos DB collection. The processing can be a simple transformation of the DateTime data element to another format or change of currency. The state of the order (data) will be inserted into Cosmos DB.
Another example with regards to idempotency could be a function with an automated task using the timer trigger. The function must run once a day; therefore you need to write so it can run any time during the day with the same results. Furthermore, the function could exit if there’s no work or if a run fails the function picks where the previous left off.
In a serverless architecture, your functions should “do one thing”, be stateless and idempotent, and finish as quickly as possible.
Finally, in case you do need state you can use Durable Functions.