Share via

Please update this module code

Amit Kumar 5 Reputation points
2024-07-02T16:45:37.1533333+00:00

please update the code for function.json

It should be something like this: (Notice there is change connection:cosmos... and containerName:Bookmarks )

{
  "bindings": [
    {
      "authLevel": "function",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": [
        "get",
        "post"
      ]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    },
    {
      "name": "bookmark",
      "direction": "in",
      "type": "cosmosDB",
      "partitionKey": "{id}",
      "databaseName": "amit65391",
      "containerName": "Bookmarks",
      "connection": "cosmos-db-amit_DOCUMENTDB",
      "id": "{id}"
    }
  ]
}

This question is related to the following Learning Module

Azure | Azure Training

1 answer

Sort by: Most helpful
  1. pnaroju 3,170 Reputation points Microsoft External Staff Moderator
    2024-07-03T07:50:59.1933333+00:00

    Hi Amit Kumar,

    Thank you for reaching out to us on the Microsoft Q&A forum.

    As outlined in the documentation under the "Modify your function's JSON implementation code" section, step 2 specifies that we should replace "your-database" with the name of our Azure Cosmos DB account.

    Please refer to the attached screenshot below for reference:

    image cosmosdb For example, you can update "connection": "your-database_DOCUMENTDB" to "connection": "mycosmosdb1234_DOCUMENTDB" in the function.json file.

    Kindly note that there is no need to update the code of the function.json file in the document. The function.json file contains placeholder values (e.g., 'your-database') which should be substituted with our specific details wherever necessary.

    Should you have further questions or need additional assistance, please feel free to reach out. We are happy to help you.

    If you find this information beneficial, please indicate your acknowledgment by clicking the "Upvote" and "Accept Answer" buttons on the post.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.