Skip to content

Commit 878e761

Browse files
author
Matias Quaranta
committed
Adding article and TOC
1 parent 261a9c7 commit 878e761

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

articles/cosmos-db/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,8 @@
533533
items:
534534
- name: Azure Cosmos DB Trigger logs
535535
href: how-to-configure-cosmos-db-trigger-logs.md
536+
name: Azure Cosmos DB Trigger connection mode
537+
href: how-to-configure-cosmos-db-trigger-connectionmode.md
536538
- name: Multiple Azure Cosmos DB Triggers
537539
href: how-to-create-multiple-cosmos-db-triggers.md
538540
- name: Troubleshoot Azure Cosmos DB Triggers
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: Azure Cosmos DB Trigger connection mode
3+
description: Learn how to configure the Azure Cosmos DB Trigger connection mode
4+
author: ealsur
5+
ms.service: cosmos-db
6+
ms.topic: sample
7+
ms.date: 06/03/2019
8+
ms.author: maquaran
9+
---
10+
11+
# How to configure the Connection Mode used by Azure Cosmos DB Trigger
12+
13+
This article describes how you can configure the Connection Mode used by the Azure Cosmos DB Trigger to connect to your Azure Cosmos account.
14+
15+
## Why is the Connection Mode important?
16+
17+
Our [performance tips](./performance-tips.md#networking) explain in detail the effect of the different Connection Modes. By default, **Gateway** is used to establish all connections on the Azure Cosmos DB Trigger. It might not be the best option for performance-driven scenarios.
18+
19+
## Changing the Connection Mode and Protocol
20+
21+
To change the default Connection Mode and Protocol used by the Azure Cosmos DB Trigger (and all the [Azure Cosmos DB bindings](./functions-bindings-cosmosdb-v2.md#output)), you need to locate the `host.json` file in your Azure Functions project or Azure Functions App and manually add the following [extra setting](./functions-bindings-cosmosdb-v2.md#hostjson-settings):
22+
23+
```js
24+
{
25+
"cosmosDB": {
26+
"connectionMode": "Direct",
27+
"protocol": "Tcp"
28+
}
29+
}
30+
```
31+
32+
Where `connectionMode` must have the desired Connection Mode (Direct or Gateway) and `protocol` the desired Connection Protocol (Tcp or Https).
33+
34+
If your Azure Functions project is working with Azure Functions V1 runtime, the configuration has a slight name difference:
35+
36+
```js
37+
{
38+
"documentDB": {
39+
"connectionMode": "Direct",
40+
"protocol": "Tcp"
41+
}
42+
}
43+
```
44+
45+
## Next steps
46+
47+
* [Connection limits in Azure Functions](../azure-functions/manage-connections.md#connection-limit)
48+
* [Azure Cosmos DB performance tips](./performance-tips.md)

0 commit comments

Comments
 (0)