[BUG] Azure Data Tables rejects Microsoft Entra authentication using Azure Cosmos DB for Table #47332
Labels
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Tables
Library name and version
Azure.Data.Tables 12.9.1
Describe the bug
Note: this bug also existed for the Python package, but was resolved a few weeks ago.
You cannot use the Azure.Data.Tables package to authenticate to Azure Cosmos DB for Table using Managed Identity / RBAC against Entra.
Expected behavior
Using managed identity, I should be able to communicate with a CosmosDb table in Azure.
The following line of code should work without exception:
Actual behavior
When using code the block, you will get a 401 odata error:
"odata.error":{"code":"Unauthorized","message":{"lang":"en-us","value":"Request blocked by Auth Provided AAD token is intended for [https://storage.azure.com]. This database account accepts tokens intended for [https://mycosmosdb.documents.azure.com, https://mycosmosdb.sql.cosmos.azure.com, https://mycosmosdbsqlx.cosmos.azure.com, https://cosmos.azure.com].\r\nActivityId: 885e33b1-cfea-4348-8371-dea70889b0ae, documentdb-dotnet-sdk/2.14.0 Host/64-bit MicrosoftWindowsNT/10.0.20348.0\nRequestID:885e33b1-cfea-4348-8371-dea70889b0ae\n"}}}
Workaround
The current workaround for me is to use this tokenprovider specifically for Cosmos:
Reproduction Steps
Prerequisite: the user has role Cosmos DB Built-in Data Contributor on the CosmosDb account. Role id = 00000000-0000-0000-0000-000000000002
Following code block should execute correctly.
Environment
Ubuntu 24.04
.NET version 8.0.110
Jetbrains Rider 2024.3
The text was updated successfully, but these errors were encountered: