How to re-enable CosmosDB login keys

Ryan McGee 0 Reputation points
2023-07-17T22:33:25.3933333+00:00

When trying to login to CosmosDB with a connection string, we receive the error:

"Invalid or missing access token"

We've tried with several different tools using the connection string copied directly from the portal.

User's image

When we originally created our CosmosDB account, we disabled local authentication / key login using the procedure documented here:
https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-setup-rbac#disable-local-auth

We are able to login with managed identities and our individual AAD users and everything worked as expected.

Now, we are trying to integrate a third party tool that doesn't work with AAD identities so we are trying to turn the login keys back on. I deployed an ARM template on top of the existing resource and updated the disableLocalAuth property to equal false and disableKeyBasedMetadataWriteAccess to false. When I export a template, I can see that those properties are set as intended.
User's image

Is there something else I need to do to get the login keys to work again?

Thanks!

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,901 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan McGee 0 Reputation points
    2023-07-18T21:44:58.1766667+00:00

    Oury, Thank you so much for the help.

    I'm not entirely sure if it was regenerating the key that fixed it or I fixed a rather silly mistake on my part. I'll swallow my pride and post what I did in case it helps someone else.

    I setup a super simple test case in C# to eliminate the variables and try to authenticate both way. I reset the key then clicked the copy button for the connection string. When I pasted the connection string into my code, the value of the clipboard was literally:

    *********************************************************************************************************************************

    I had thought that when I pasted the connection string into the third party tools, it was masking it like a password field... it wasn't.

    I had to click the eye icon before clicking the copy icon in order to copy the actual connection string.

    Now I just need a way to tell my client that the problem is fixed without sounding like a dufus.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.