You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Migrate apps from Azure Cosmos DB extension version 3.x to version 4.x
11
11
12
-
This article highlights considerations of upgrading your existing Azure Functions applications that use the Azure Cosmos DB extension version 3.x to use the newer extension version 4.x. Migrating to this version 4.x of the Azure Cosmos DB extension has breaking changes for your application.
12
+
This article highlights considerations for upgrading your existing Azure Functions applications that use the Azure Cosmos DB extension version 3.x to use the newer [extension version 4.x](./functions-bindings-cosmosdb-v2.md?tabs=extensionv4). Migrating from version 3.x to version 4.x of the Azure Cosmos DB extension has breaking changes for your application.
13
13
14
14
> [!IMPORTANT]
15
15
> On August 31, 2024 the Azure Cosmos DB extension version 3.x will be retired. The extension and all applications using the extension will continue to function, but Azure Cosmos DB will cease to provide further maintenance and support for this extension. We recommend migrating to the latest version 4.x of the extension.
@@ -52,7 +52,7 @@ Update your `.csproj` project file to use the latest extension version. The foll
52
52
```
53
53
54
54
::: zone-end
55
-
::: zone pivot="programming-language-java,programming-language-javascript,programming-language-typescript,programming-language-powershell,programming-language-python"
55
+
::: zone pivot="programming-language-javascript,programming-language-python,programming-language-java,programming-language-powershell"
56
56
57
57
## Update the extension bundle
58
58
@@ -78,15 +78,15 @@ To update your application to use the latest extension bundle, update your `host
78
78
79
79
Both [in-process](functions-dotnet-class-library.md) and [isolated process](dotnet-isolated-process-guide.md) C# libraries use the [CosmosDBTriggerAttribute](https://github.com/Azure/azure-webjobs-sdk-extensions/blob/master/src/WebJobs.Extensions.CosmosDB/Trigger/CosmosDBTriggerAttribute.cs) to define the function. C# script instead uses a function.json configuration file as described in the [C# scripting guide](./functions-reference-csharp.md#cosmos-db-trigger).
80
80
81
-
The following table only includes attributes that changed or were removed from the version 3.x extension in the version 4.x extension. For a full list of attributes available in the version 4 extension, visit the [attribute reference](./functions-bindings-cosmosdb-v2-trigger.md#attributes).
81
+
The following table only includes attributes that were renamed or were removed from the version 3 extension. For a full list of attributes available in the version 4 extension, visit the [attribute reference](./functions-bindings-cosmosdb-v2-trigger.md?tabs=extensionv4#attributes).
|**ConnectionStringSetting**|**Connection**| The name of an app setting or setting collection that specifies how to connect to the Azure Cosmos DB account being monitored. For more information, see [Connections](#connections).|
85
+
|**ConnectionStringSetting**|**Connection**| The name of an app setting or setting collection that specifies how to connect to the Azure Cosmos DB account being monitored. For more information, see [Connections](./functions-bindings-cosmosdb-v2-trigger.md#connections).|
86
86
|**CollectionName**|**ContainerName**| The name of the container being monitored. |
87
87
|**LeaseConnectionStringSetting**|**LeaseConnection**| (Optional) The name of an app setting or setting collection that specifies how to connect to the Azure Cosmos DB account that holds the lease container. <br><br> When not set, the `Connection` value is used. This parameter is automatically set when the binding is created in the portal. The connection string for the leases container must have write permissions.|
88
88
|**LeaseCollectionName**|**LeaseContainerName**| (Optional) The name of the container used to store leases. When not set, the value `leases` is used. |
89
-
|**CreateLeaseCollectionIfNotExists**|**CreateLeaseContainerIfNotExists**| (Optional) When set to `true`, the leases container is automatically created when it doesn't already exist. The default value is `false`. When using Azure AD identities if you set the value to `true`, creating containers isn't [an allowed operation](../articles/cosmos-db/sql/troubleshoot-forbidden.md#non-data-operations-are-not-allowed) and your Function won't be able to start.|
89
+
|**CreateLeaseCollectionIfNotExists**|**CreateLeaseContainerIfNotExists**| (Optional) When set to `true`, the leases container is automatically created when it doesn't already exist. The default value is `false`. When using Azure AD identities if you set the value to `true`, creating containers isn't [an allowed operation](../cosmos-db/nosql/troubleshoot-forbidden.md#non-data-operations-are-not-allowed) and your Function won't be able to start.|
90
90
|**LeasesCollectionThroughput**|**LeasesContainerThroughput**| (Optional) Defines the number of Request Units to assign when the leases container is created. This setting is only used when `CreateLeaseContainerIfNotExists` is set to `true`. This parameter is automatically set when the binding is created using the portal. |
91
91
|**LeaseCollectionPrefix**|**LeaseContainerPrefix**| (Optional) When set, the value is added as a prefix to the leases created in the Lease container for this function. Using a prefix allows two separate Azure Functions to share the same Lease container by using different prefixes. |
92
92
|**UseMultipleWriteLocations**|*Removed*| This attribute is no longer needed as it's automatically detected. |
@@ -95,21 +95,21 @@ The following table only includes attributes that changed or were removed from t
95
95
|**CheckpointDocumentCount**|*Removed*| This attribute has been removed in the version 4 extension. |
96
96
97
97
::: zone-end
98
-
::: zone pivot="programming-language-java,programming-language-javascript,programming-language-typescript,programming-language-powershell,programming-language-python"
98
+
::: zone pivot="programming-language-javascript,programming-language-python,programming-language-java,programming-language-powershell"
99
99
100
100
## Rename the binding attributes
101
101
102
102
Update your binding configuration properties in the `function.json` file.
103
103
104
-
The following table only includes attributes that changed or were removed from the version 3.x extension in the version 4.x extension. For a full list of attributes available in the version 4 extension, visit the [attribute reference](./functions-bindings-cosmosdb-v2-trigger.md#attributes).
104
+
The following table only includes attributes that changed or were removed from the version 3.x extension. For a full list of attributes available in the version 4 extension, visit the [attribute reference](./functions-bindings-cosmosdb-v2-trigger.md#attributes).
|**connectionStringSetting**|**connection**| The name of an app setting or setting collection that specifies how to connect to the Azure Cosmos DB account being monitored. For more information, see [Connections](#connections).|
109
-
|**collectionName**|**dontainerName**| The name of the container being monitored. |
108
+
|**connectionStringSetting**|**connection**| The name of an app setting or setting collection that specifies how to connect to the Azure Cosmos DB account being monitored. For more information, see [Connections](./functions-bindings-cosmosdb-v2-trigger.md#connections).|
109
+
|**collectionName**|**containerName**| The name of the container being monitored. |
110
110
|**leaseConnectionStringSetting**|**leaseConnection**| (Optional) The name of an app setting or setting collection that specifies how to connect to the Azure Cosmos DB account that holds the lease container. <br><br> When not set, the `connection` value is used. This parameter is automatically set when the binding is created in the portal. The connection string for the leases container must have write permissions.|
111
111
|**leaseCollectionName**|**leaseContainerName**| (Optional) The name of the container used to store leases. When not set, the value `leases` is used. |
112
-
|**createLeaseCollectionIfNotExists**|**createLeaseContainerIfNotExists**| (Optional) When set to `true`, the leases container is automatically created when it doesn't already exist. The default value is `false`. When using Azure AD identities if you set the value to `true`, creating containers isn't [an allowed operation](../articles/cosmos-db/sql/troubleshoot-forbidden.md#non-data-operations-are-not-allowed) and your Function won't be able to start.|
112
+
|**createLeaseCollectionIfNotExists**|**createLeaseContainerIfNotExists**| (Optional) When set to `true`, the leases container is automatically created when it doesn't already exist. The default value is `false`. When using Azure AD identities if you set the value to `true`, creating containers isn't [an allowed operation](../cosmos-db/nosql/troubleshoot-forbidden.md#non-data-operations-are-not-allowed) and your Function won't be able to start.|
113
113
|**leasesCollectionThroughput**|**leasesContainerThroughput**| (Optional) Defines the number of Request Units to assign when the leases container is created. This setting is only used when `createLeaseContainerIfNotExists` is set to `true`. This parameter is automatically set when the binding is created using the portal. |
114
114
|**leaseCollectionPrefix**|**leaseContainerPrefix**| (Optional) When set, the value is added as a prefix to the leases created in the Lease container for this function. Using a prefix allows two separate Azure Functions to share the same Lease container by using different prefixes. |
115
115
|**useMultipleWriteLocations**|*Removed*| This attribute is no longer needed as it's automatically detected. |
@@ -122,7 +122,7 @@ The following table only includes attributes that changed or were removed from t
122
122
123
123
## Modify your Function code
124
124
125
-
The Azure Functions extension version 4 is built on top of the Azure Cosmos DB .NET SDK version 3, which removed support for the [`Document` class](../cosmos-db/nosql/migrate-dotnet-v3.md#major-name-changes-from-v2-sdk-to-v3-sdk). Instead of receiving a list of `Document` objects with each function invocation, which you must then deserialize into your own object type, you can now receive a list of objects of your own type.
125
+
The Azure Functions extension version 4 is built on top of the Azure Cosmos DB .NET SDK version 3, which removed support for the [`Document` class](../cosmos-db/nosql/migrate-dotnet-v3.md#major-name-changes-from-v2-sdk-to-v3-sdk). Instead of receiving a list of `Document` objects with each function invocation, which you must then deserialize into your own object type, you can now directly receive a list of objects of your own type.
126
126
127
127
This example refers to a simple `ToDoItem` type.
128
128
@@ -169,7 +169,7 @@ namespace CosmosDBSamples
169
169
```
170
170
171
171
::: zone-end
172
-
::: zone pivot="programming-language-java,programming-language-javascript,programming-language-typescript,programming-language-powershell,programming-language-python"
172
+
::: zone pivot="programming-language-javascript,programming-language-python,programming-language-java,programming-language-powershell"
0 commit comments