Cosmos DB¶
Use Cosmos DB bindings and SDK patterns from isolated worker functions.
flowchart TD
A[Trigger] --> B[Function]
B --> C[Binding or SDK]
C --> D[Azure service] Topic/Command Groups¶
Cosmos DB trigger/input bindings¶
[Function("CosmosReader")]
public void CosmosReader(
[CosmosDBTrigger(
databaseName: "appdb",
containerName: "orders",
Connection = "CosmosConnection",
LeaseContainerName = "leases")] string[] documents)
{
}
Cosmos DB output binding¶
[Function("WriteOrder")]
[CosmosDBOutput("appdb", "orders", Connection = "CosmosConnection")]
public Order WriteOrder([HttpTrigger(AuthorizationLevel.Function, "post", Route = "orders")] HttpRequestData req)
{
return new Order { Id = Guid.NewGuid().ToString(), Status = "created" };
}
Review Matrix¶
| Review area | Page-specific check |
|---|---|
| Scope | Confirm the guidance applies to Cosmos DB. |
| Source basis | Validate the recommendation against the Microsoft Learn sources in this page. |
| Evidence | Capture command output, portal state, metrics, logs, or screenshots before treating the result as proven. |