Hi
Kushv •,
Welcome to Microsoft Q&A forum and thanks for using Azure Services.
As I understand, you are getting error "Client initialization failed. Check if the endpoint is reachable and if your auth token is valid." when Migrate an application to use passwordless connections with Azure Cosmos DB for NoSQL.
Could you please make sure if the role is correct?
When developing locally with passwordless authentication, make sure the user account that connects to Cosmos DB is assigned a role with the correct permissions to perform data operations. Currently, Azure Cosmos DB for NoSQL doesn't include built-in roles for data operations, but you can create your own using the Azure CLI or PowerShell.
Roles consist of a collection of permissions or actions that a user is allowed to perform, such as read, write, and delete. You can read more about configuring role-based access control (RBAC) in the Cosmos DB security configuration documentation.
Refer: Create the custom role
Please check and let us know.
Thanks