azureazure-cosmosdbazure-virtual-networkazure-private-linkazure-private-dns

Connection Authentication to Azure CosmosDB through Private Link


I created a Private Link connection between an Azure VM and a CosmosDB MongoDB Account.

In order to clear out the need for token authentication and taking into account the best practices, I assigned a custom role to the Virtual Machine which has permissions to read and write to CosmosDB.

Now I am trying to connect the VM to CosmosDB using Python (pymongo) without any type of authentication on the uri string. Nevertheless, I am having auth errors and I cannot seem to find any relevant example or information regarding this matter.

Is there any way to achieve this? If not, what are my alternatives? Must I use tokens even with a private link?


Solution

  • @Anupam Chand Thank you for your response in the comment section.

    Yes, We Can avoid tokens by creating a service principal for your VM and then assign the appropriate RBAC to the service principal. At present .NET , Java and JavaScript SDKs are currently supported. Python SDK not yet available.