Skip to content

Commit 1e0a7ea

Browse files
Merge pull request #266176 from ealsur/users/ealsur/cosmostutorial3
Cosmos DB: Updating references to Cosmos DB extension on Azure Functions tutorials
2 parents 0095d9c + de84db2 commit 1e0a7ea

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

articles/azure-functions/durable/durable-functions-instance-management.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Manage instances in Durable Functions - Azure
33
description: Learn how to manage instances in the Durable Functions extension for Azure Functions.
44
author: cgillum
55
ms.topic: conceptual
6-
ms.date: 12/07/2022
6+
ms.date: 02/13/2024
77
ms.author: azfuncdf
88
ms.devlang: csharp
99
# ms.devlang: csharp, java, javascript, python
@@ -1109,10 +1109,10 @@ Functions can send instances of these objects to external systems to monitor or
11091109
public static void SendInstanceInfo(
11101110
[ActivityTrigger] IDurableActivityContext ctx,
11111111
[DurableClient] IDurableOrchestrationClient client,
1112-
[DocumentDB(
1112+
[CosmosDB(
11131113
databaseName: "MonitorDB",
1114-
collectionName: "HttpManagementPayloads",
1115-
ConnectionStringSetting = "CosmosDBConnection")]out dynamic document)
1114+
containerName: "HttpManagementPayloads",
1115+
Connection = "CosmosDBConnectionSetting")]out dynamic document)
11161116
{
11171117
HttpManagementPayload payload = client.CreateHttpManagementPayload(ctx.InstanceId);
11181118

articles/azure-functions/functions-add-output-binding-cosmos-db-vs-code.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Connect Azure Functions to Azure Cosmos DB using Visual Studio Code
33
description: Learn how to connect Azure Functions to an Azure Cosmos DB account by adding an output binding to your Visual Studio Code project.
4-
ms.date: 02/09/2023
4+
ms.date: 02/13/2024
55
ms.topic: quickstart
66
zone_pivot_groups: programming-languages-set-functions-temp
77
ms.devlang: csharp
@@ -76,10 +76,10 @@ In the [previous quickstart article](./create-first-function-vs-code-csharp.md),
7676

7777
|Prompt| Selection|
7878
|--|--|
79-
|**Enter new app setting name**| Type `CosmosDbConnectionString`.|
80-
|**Enter value for "CosmosDbConnectionString"**| Paste the connection string of your Azure Cosmos DB account you copied.|
79+
|**Enter new app setting name**| Type `CosmosDbConnectionSetting`.|
80+
|**Enter value for "CosmosDbConnectionSetting"**| Paste the connection string of your Azure Cosmos DB account you copied. You can also configure [Microsoft Entra identity](./functions-bindings-cosmosdb-v2-trigger.md#connections) as an alternative.|
8181

82-
This creates an application setting named connection `CosmosDbConnectionString` in your function app in Azure. Now, you can download this setting to your local.settings.json file.
82+
This creates an application setting named connection `CosmosDbConnectionSetting` in your function app in Azure. Now, you can download this setting to your local.settings.json file.
8383

8484
1. Press <kbd>F1</kbd> again to open the command palette, then search for and run the command `Azure Functions: Download Remote Settings...`.
8585

@@ -97,11 +97,11 @@ Except for HTTP and timer triggers, bindings are implemented as extension packag
9797

9898
# [Isolated worker model](#tab/isolated-process)
9999
```command
100-
dotnet add package Microsoft.Azure.Functions.Worker.Extensions.CosmosDB --version 3.0.9
100+
dotnet add package Microsoft.Azure.Functions.Worker.Extensions.CosmosDB
101101
```
102102
# [In-process model](#tab/in-process)
103103
```command
104-
dotnet add package Microsoft.Azure.WebJobs.Extensions.CosmosDB --version 3.0.10
104+
dotnet add package Microsoft.Azure.WebJobs.Extensions.CosmosDB
105105
```
106106
---
107107
::: zone-end
@@ -141,7 +141,7 @@ The `documentsOut` parameter is an `IAsyncCollector<T>` type, which represents a
141141

142142
---
143143

144-
Specific attributes specify the name of the container and the name of its parent database. The connection string for your Azure Cosmos DB account is set by the `CosmosDbConnectionString`.
144+
Specific attributes specify the name of the container and the name of its parent database. The connection string for your Azure Cosmos DB account is set by the `CosmosDbConnectionSetting`.
145145

146146
::: zone-end
147147

@@ -159,7 +159,7 @@ To create a binding, right-click (Ctrl+select on macOS) the *function.json* file
159159
| **The Azure Cosmos DB database where data will be written** | `my-database` | The name of the Azure Cosmos DB database containing the target container. |
160160
| **Database collection where data will be written** | `my-container` | The name of the Azure Cosmos DB container where the JSON documents will be written. |
161161
| **If true, creates the Azure Cosmos DB database and collection** | `false` | The target database and container already exist. |
162-
| **Select setting from "local.setting.json"** | `CosmosDbConnectionString` | The name of an application setting that contains the connection string for the Azure Cosmos DB account. |
162+
| **Select setting from "local.setting.json"** | `CosmosDbConnectionSetting` | The name of an application setting that contains the connection string for the Azure Cosmos DB account. |
163163
| **Partition key (optional)** | *leave blank* | Only required when the output binding creates the container. |
164164
| **Collection throughput (optional)** | *leave blank* | Only required when the output binding creates the container. |
165165

@@ -171,9 +171,9 @@ A binding is added to the `bindings` array in your *function.json*, which should
171171
"direction": "out",
172172
"name": "outputDocument",
173173
"databaseName": "my-database",
174-
"collectionName": "my-container",
174+
"containerName": "my-container",
175175
"createIfNotExists": "false",
176-
"connectionStringSetting": "CosmosDbConnectionString"
176+
"connection": "CosmosDbConnectionSetting"
177177
}
178178
```
179179

@@ -197,7 +197,7 @@ To create a binding, right-select (Ctrl+select on macOS) the *function.json* fil
197197
| **The Azure Cosmos DB database where data will be written** | `my-database` | The name of the Azure Cosmos DB database containing the target container. |
198198
| **Database collection where data will be written** | `my-container` | The name of the Azure Cosmos DB container where the JSON documents will be written. |
199199
| **If true, creates the Azure Cosmos DB database and collection** | `false` | The target database and container already exist. |
200-
| **Select setting from "local.setting.json"** | `CosmosDbConnectionString` | The name of an application setting that contains the connection string for the Azure Cosmos DB account. |
200+
| **Select setting from "local.setting.json"** | `CosmosDbConnectionSetting` | The name of an application setting that contains the connection string for the Azure Cosmos DB account. |
201201
| **Partition key (optional)** | *leave blank* | Only required when the output binding creates the container. |
202202
| **Collection throughput (optional)** | *leave blank* | Only required when the output binding creates the container. |
203203

@@ -209,9 +209,9 @@ A binding is added to the `bindings` array in your *function.json*, which should
209209
"direction": "out",
210210
"name": "outputDocument",
211211
"databaseName": "my-database",
212-
"collectionName": "my-container",
212+
"containerName": "my-container",
213213
"createIfNotExists": "false",
214-
"connectionStringSetting": "CosmosDbConnectionString"
214+
"connection": "CosmosDbConnectionSetting"
215215
}
216216
```
217217

@@ -221,10 +221,10 @@ Binding attributes are defined directly in the *function_app.py* file. You use t
221221

222222
```python
223223
@app.cosmos_db_output(arg_name="outputDocument", database_name="my-database",
224-
collection_name="my-container", connection_string_setting="CosmosDbConnectionString")
224+
container_name="my-container", connection="CosmosDbConnectionSetting")
225225
```
226226

227-
In this code, `arg_name` identifies the binding parameter referenced in your code, `database_name` and `collection_name` are the database and collection names that the binding writes to, and `connection_string_setting` is the name of an application setting that contains the connection string for the Storage account, which is in the CosmosDbConnectionString setting in the *local.settings.json* file.
227+
In this code, `arg_name` identifies the binding parameter referenced in your code, `database_name` and `container_name` are the database and collection names that the binding writes to, and `connection` is the name of an application setting that contains the connection string for the Azure Cosmos DB account, which is in the `CosmosDbConnectionSetting` setting in the *local.settings.json* file.
228228

229229
---
230230

@@ -265,8 +265,8 @@ public static async Task<IActionResult> Run(
265265
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
266266
[CosmosDB(
267267
databaseName: "my-database",
268-
collectionName: "my-container",
269-
ConnectionStringSetting = "CosmosDbConnectionString")]IAsyncCollector<dynamic> documentsOut,
268+
containerName: "my-container",
269+
Connection = "CosmosDbConnectionSetting")]IAsyncCollector<dynamic> documentsOut,
270270
ILogger log)
271271
{
272272
log.LogInformation("C# HTTP trigger function processed a request.");
@@ -392,7 +392,7 @@ app = func.FunctionApp()
392392
@app.function_name(name="HttpTrigger1")
393393
@app.route(route="hello", auth_level=func.AuthLevel.ANONYMOUS)
394394
@app.queue_output(arg_name="msg", queue_name="outqueue", connection="AzureWebJobsStorage")
395-
@app.cosmos_db_output(arg_name="outputDocument", database_name="my-database", collection_name="my-container", connection_string_setting="CosmosDbConnectionString")
395+
@app.cosmos_db_output(arg_name="outputDocument", database_name="my-database", container_name="my-container", connection="CosmosDbConnectionSetting")
396396
def test_function(req: func.HttpRequest, msg: func.Out[func.QueueMessage],
397397
outputDocument: func.Out[func.Document]) -> func.HttpResponse:
398398
logging.info('Python HTTP trigger function processed a request.')

0 commit comments

Comments
 (0)