Azure Functions provides a small serverless endpoint for event-triggered application work. A feedback workflow uses an HTTP-triggered function to accept ratings and comments, then write them to Cosmos DB. section 6.3 section 6.7
Place the function between the browser and the database rather than exposing database credentials in client-side JavaScript. Server-side environment variables, Key Vault, and role-based access control protect secrets, while a separate function isolates quick, bursty writes from long-lived chat streaming. section 6.5
A practical Azure Functions workflow includes:
- Create a Cosmos DB feedback container and configure its endpoint, key, database name, and container name through environment variables. section 6.3
- Implement a Python HTTP-triggered function that reads question, answer, email, rating, and reason values before storing an item. section 6.7
- Install dependencies and Azure Functions Core Tools, start the local runtime, and exercise the endpoint with a REST client. section 6.7
- Review stored feedback in Cosmos DB and query recent negative ratings for operational follow-up. section 6.11
Feedback capture endpoint
A browser submits a thumbs-down rating and explanation to an HTTP-triggered function. The function stores the JSON record in Cosmos DB, where recent complaints can be inspected or monitored for spikes. section 6.11
Figure 6.4 The relationship between your web browser and CosmosDB. We have a function app in the middle for database security.
Use the architecture figure to trace the browser-to-function-to-Cosmos DB boundary and understand where database security is enforced. section 6.5

