The example you have sent is about Azure Cosmos DB for NoSQL and it supports passwordless auth locally for development purposes by nature. But Azure Cosmos DB for MongoDB does not have passwordless auth option
But instead it supports authentication with key
https://video2.skills-academy.com/en-us/azure/cosmos-db/secure-access-to-data?tabs=using-primary-key