I have a ruby on rails application. I am using mongoid
gem to connect to Azure cosmos db for mongo service on azure. Currently, I use username and password for authentication. Instead of using username and password for authentication, I want to use Azure Managed Identity.
In config/mongoid.yml
file, following is the configuration
options:
user: <%= ENV['USERNAME'] %>
password: <%= ENV['PASSWORD'] %>
ssl: true
auth_source: admin
Also, documentation of mongoid says, qouting the documentation here:-
Change the default authentication mechanism. Valid options are: :scram, :mongodb_cr, :mongodb_x509, and :plain. Note that all authentication mechanisms require username and password, with the exception of :mongodb_x509. Default on mongoDB 3.0 is :scram, default on 2.4 and 2.6 is :plain.
I have gone through the following documentation, where they have used AzureIdentity library for .Net, Java, Javascript to authenticate using MI. I am looking for the same for ruby on rails.
Could anyone please help/guide me with this?
Currently Cosmos DB for Mongo DB(Both vCore and RU mode) do not support Managed Identity. The documentation that you're seeing is applicable to Cosmos DB NOSQL API only.