'Connect CLaaS container to CosmosDB
I have a application running on a AKS Container and would like to use the Azure Cosmos DB for storage. How can i set this up?
I think i just need to specify the ip address from which the requests are originating on the k8s cluster so that the cosmosdb will allow access.
Should this traffic go over the internet or is it possible to set up a connection between the vnets?
Solution 1:[1]
To connect to CosmosDB easiest way is to just use SDK provided by Microsoft in your app. You just provide your app a connection string to your database, here is a simple quickstart example. You don't have to open any network traffic on CosmosDB side if you use default configuration, but of course if you wish you can lock access to only selected networks. So if your containers have internet access they can also access your database.
To address your second concern to not go over internet you can get more information here.
To allow access from existing virtual network using portal you need to go to the cosmosdb resource into firewall tab and add existing network, you should see something like this:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |