How to use MSI workload identity to authenticate to CosmosDB Cassandra

Jordan Bar (He/him/his) 0 Reputation points
2025-07-21T18:05:26.61+00:00

Hello,
I've provisioned a CosmosDB Cassandra instance, have it configured with private endpoint. the DB is routable/accessible.

My question is about using an MSI (either Entra ID Group or a k8s federated Workload Identity to authenticate/authorize queries against the DB, using gocql library.
It is unclear how set the password in the Authenticator struct.

If I enable CosmosDB local-authentication, then of-course I can establish a connection, but that is using static-credentials, and the rotation of these credentials poses an operationl risk.
When compared to MSI-based authN/Z which is much more secure and streamlined.

Although I've assigned both the control-plane "DocumentDB Account Contributor" and the data-plane internal data-contributor, I'm getting a 403 when trying to authenticate.

I've tried using "azidentity.NewDefaultAzureCredential(nil).GetToken().Token" as the password, but to no avail.

Anyone else facing the same issue? or something I'm missing in CosmosDB AuthN/Z design?

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

Your answer

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