Help verify what code changes to be made for "Update to Azure Cosmos DB extension version 4.x for Azure Functions"

mg-e1001 0 Reputation points
2024-03-28T13:11:45.2733333+00:00

Hello,

I had received the email notification from Microsoft in regards to "Update to Azure Cosmos DB extension version 4.x for Azure Functions by 31 August 2024".I have looked through and gone through some of the starting migration steps of updating the Microsoft.Azure.WebJobs.Extensions.CosmosDB version as mentioned in https://learn.microsoft.com/en-us/azure/azure-functions/migrate-cosmos-db-version-3-version-4?tabs=in-process&pivots=programming-language-csharp#top. 

I wanted clarification on exactly what code changes that need to be made. In that same migration link mentioned in the email, the section of "Modify your function code" shows a function using CosmosDBTrigger. 

So would code I would need to modify just be functions that use CosmosDBTrigger or is there anything else if my functions that I would need to look for that I would need to modify? I currently don't use CosmosDBTrigger in my code.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,266 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,443 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 15,216 Reputation points
    2024-03-29T15:52:13.2766667+00:00

    I checked the article and for the section Modify your code :

    The Version 4 update for the Azure Functions Cosmos DB extension leverages the Azure Cosmos DB .NET SDK Version 3, which no longer supports the Document class. This change means that instead of getting a list of Document objects that you need to deserialize into your custom types with each function call, you can now directly obtain a list of your specific object type.

    The example shows that you need to apply the changes to the attribute names must be made directly in the code when defining your Function.