Add support of Azure Cosmos DB for MongoDB (vCore)
- Dominant language
- C#
- Stars
- 10.9k
- Forks
- 2.1k
- Avg merge
- 14h 42m
- Merged PRs (30d)
- 354
Description
Please add supports for new Azure Cosmos Db with MongoDB API .NET SDK
https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/vcore/quickstart-dotnet
All teams that use AKS rely on Workload Identity. It should support `Azure.Core.TokenCredential`, `DefaultAzureCredential` and `WorkloadIdentityCredential`.
This SDK must work in multiple environments:
1. Localhost Mongo running in docker / docker-compose with basic user password auth.
2. Minikube hosted Mongo with basic user-password auth.
3. In future support Aspire
4. Azure Container App with Managed Identity Auth
5. AKS in public Azure with Workload Identity in federation with Managed Identity
6. Azure Local AKS disconnected from azure Workload Identity.
This auth must work with both basic auth and Azure.Core.TokenCredential handles all cases.
Localhost Mongo debugging environment docker-compose looks like this
``` yaml
# The only local MongoDB replica set with Docker Compose guide you'll ever need!
# https://anthonysimmon.com/the-only-local-mongodb-replica-set-with-docker-compose-guide-youll-ever-need/
mongo:
container_name: mongo
image: mongo:latest
command: [
# Replica set is mandatory for transactions and change streams https://www.mongodb.com/community/forums/t/why-replica-set-is-mandatory-for-transactions-in-mongodb/9533
"--replSet", "rs0",
# bind the MongoDB instance to all IPv4 addresses https://www.mongodb.com/docs/manual/core/security-mongodb-configuration/
"--bind_ip_all",
"--port", "27017" # default port for MongoDB
]
healthcheck:
# initialize replica set https://anthonysimmon.com/the-only-local-mongodb-replica-set-with-docker-compose-guide-youll-ever-need/
test: echo "try { rs.status() } catch (err) { rs.initiate({_id:'rs0',members:[{_id:0,host:'host.docker.internal:27017'}]}) }" | mongosh --port 27017 --quiet
interval: 5s
timeout: 30s
start_period: 0s
start_interval: 1s
retries: 30
ports:
- 27017:27017 # MongoDB port
volumes:
- ./docker/mongo/data:/data/db # Mongo data storage
networks:
- stargate
# Mongo DB Web Portal: https://github.com/mongo-express/mongo-express-docker
mongo-express:
container_name: mongo-express
image: mongo-express:latest
ports:
- 7022:8081
environment:
ME_CONFIG_MONGODB_URL: mongodb://host.docker.internal:27017/?replicaSet=rs0
# when you one portal, will have to enter username and password to access it.
ME_CONFIG_BASICAUTH_USERNAME: admin
ME_CONFIG_BASICAUTH_PASSWORD: admin
depends_on:
- mongo
networks:
- stargate
```
Thanks @ReubenBond !
Contributor guide
Research direction
No repository files or tests are named. Start with the linked Azure Cosmos DB MongoDB vCore .NET quickstart and compare its authentication requirements with the provided Docker Compose MongoDB setup. Done means support is defined and verified for basic authentication and Azure.Core.TokenCredential across the listed local, container, AKS, and disconnected environments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, docker, kubernetes, mongodb
- Domain
- authentication, backend, cloud, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100