I'd like to use managed identity when connecting to cosmos db table api from an azure function.
Uri tableEndpoint = new Uri("https://mycosmos.table.cosmos.azure.com:443/");
var tableServiceClient = new TableServiceClient(tableEndpoint, new DefaultAzureCredential());
var tableClient = tableServiceClient.GetTableClient(tableName);
This causes the following error:
Authorization header doesn't confirm to the required format
I've read that cosmos db table api does not yet support managed identity but that was over 2 years ago - I'm hoping that it is now possible?
As per November 2023, this is still not supported (see documentation):
Which Azure Cosmos DB APIs support role-based access control?
The API for NoSQL is supported. Support for the API for MongoDB is in preview.
Azure Storage Table do support managed identity and could be an alternative:
Storage Table Data Contributor
or Storage Table Data Reader
role to the managed identity.And here is a good article to check between storage and cosmos table: