RBAC for cosmos DB Table API

Sam Chen 25 Reputation points Microsoft Employee
2025-11-06T16:40:05.49+00:00

Hi Team,

I am using Azure Cosmos DB table APIs and I enabled my account in access control and assigned following roles to the resource. However I still get the following error when trying to access the account. Any thoughts?

Test method Microsoft.Skype.Platform.Echo.Tests.CallQueue.CosmosDbTableApiTests.NaiveTest threw exception: `

Azure.RequestFailedException: Request blocked by Auth samtest : Request is blocked because principal [PII removed] does not have required RBAC permissions to perform action [Microsoft.DocumentDB/databaseAccounts/readMetadata] on resource [/]. Learn more: https://aka.ms/cosmos-native-rbac.

ActivityId: PII removed,

Microsoft.Azure.Documents.Common/2.14.0, documentdb-dotnet-sdk/2.14.0 Host/64-bit MicrosoftWindowsNT/10.0.20348.0

RequestID: PII removed

Status: 403 (Forbidden)

ErrorCode: Forbidden

Roles:

User's image

Azure Role-based access control
Azure Role-based access control
An Azure service that provides fine-grained access management for Azure resources, enabling you to grant users only the rights they need to perform their jobs.
{count} votes

Answer accepted by question author
  1. Sridevi Machavarapu 7,610 Reputation points Microsoft External Staff Moderator
    2025-11-06T17:27:54.3166667+00:00

    Hello Sam Chen,

    The error occurs because the roles assigned (Owner, Contributor, Cosmos DB Operator, DocumentDB Account Contributor) are control-plane roles, which don't grant the data-plane permissions required by Cosmos DB Table API.

    Specifically, the action Microsoft.DocumentDB/databaseAccounts/readMetadata needs a built-in data role.

    To fix this, assign one of the Cosmos DB built-in data roles at the account scope (/) to the user or managed identity:

    • Cosmos DB Built-in Data Reader (Role ID: 00000000-0000-0000-0000-000000000001)
    • Cosmos DB Built-in Data Contributor (Role ID: 00000000-0000-0000-0000-000000000002)

    For example, using Azure CLI:

    az cosmosdb sql role assignment create \
      --resource-group <resource-group> \
      --account-name <cosmos-account> \
      --scope "/" \
      --principal-id <user-object-id> \
      --role-definition-id "00000000-0000-0000-0000-000000000002"
    

    Make sure to replace placeholders with your actual values.

    This approach grants the necessary data-plane permissions and resolves the 403 Forbidden RBAC error.

    For more details, refer these MS Documentation:

    Hope this helps! Let us know if any further queries.

    If this answers your query, do click Accept Answer and Yes for was this answer helpful, which may help members with similar questions.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

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.