Permissions required to update a comos db document.

Saurabh Sharma 23,866 Reputation points Microsoft Employee Moderator
2025-10-23T19:05:07.2033333+00:00

Hi,

I am seeking to update a document in Azure Cosmos DB; however, my attempts with Cosmos DB operator permissions were unsuccessful. Could you please clarify which specific permissions are required to perform this action?

Thanks

Saurabh

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
{count} votes

1 answer

Sort by: Most helpful
  1. Swapnesh Panchal 750 Reputation points Microsoft External Staff Moderator
    2025-10-23T20:23:02.14+00:00

    Hi Saurabh Sharma,
    Thank you for reaching out to Microsoft Q&A.

    • Cosmos DB Built-in Data Contributor role (data-plane)
      Please go with the Cosmos DB Built-in Data Contributor role (data-plane) at the correct scope to update documents.
      like:
    • Data-plane actions:
      • Microsoft.DocumentDB/databaseAccounts/read
      • Microsoft.DocumentDB/databaseAccounts/listKeys/action
      • Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/* (covers replace, upsert, delete, read for documents)
    • CRUD operations on items within containers.
    • Query execution on containers.

    This role does NOT allow account-level management (control-plane) but enables full document-level operations.
    reference: https://free.blessedness.top/azure/cosmos-db/how-to-setup-rbac#built-in-role-definitions

    “Cosmos DB Operator” won’t let you modify documents — it’s a control-plane role (manage the account) and explicitly blocks data access and even the account keys/connection strings.

    To update a document, you need a data-plane permission. The simplest built-in choice is Cosmos DB Built-in Data Contributor assigned at the right scope (account / database / container). That role includes the item actions needed to update (replace/upsert) documents, e.g. …/containers/items/replace, …/containers/items/upsert, and the usual CRUD/query actions.

    Quick path (pick one):

    Entra ID / RBAC (recommended) – Assign “Cosmos DB Built-in Data Contributor” to your user/app at the container (or db/account) scope. After that, connect with Entra ID and you can update documents.

    Key-based auth (legacy) – Use a key that has write rights; note the Operator role cannot view or regenerate keys, by design. If you’re going this route, someone with a role that allows listKeys must fetch the key for you.

    If you still get a 403 after the assignment, double-check the scope (container vs database), and that your client is actually using Entra ID (not an old connection string). The data-plane role’s ID for “Built-in Data Contributor” is listed in the docs if you prefer scripting assignments.

    Hope that clarifies which permission you need.

    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.