3

I am getting The connection string is missing a required property: AccountEndpoint error while using the new CosmosClient(CosmosConnectionString) constructor for CosmosClient with assembly Microsoft.Azure.Cosmos.Client, Version=3.11.0.0 - How to fix it? The connection string from the account looks like (AccountEndpoint is missing:

DefaultEndpointsProtocol=https;AccountName=devdb;AccountKey=xxxx;TableEndpoint=https://devdb.table.cosmos.azure.com:443/;
Sayantan Ghosh
  • 998
  • 2
  • 9
  • 29

1 Answers1

2

The connection string you're specifying is for connecting to an Azure Storage account (when you use Azure.Storage.* Nuget package) or a Cosmos DB account targeting Table API (when you use (Microsoft.Azure.Cosmos.Table package).

To connect to a Cosmos DB account using Microsoft.Azure.Cosmos package, connection string must be specified in AccountEndpoint=https://account-name.documents.azure.com:443/;AccountKey=account-key; format.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • 2
    When I copy the connection string from the db I created, I get `TableEndpoint` in that but that, now, needs to be converted to `AccountEndpoint`. What is the standard why to do that? The table endpoint looks like: TableEndpoint=https://account-name.table.cosmos.azure.com:443/ While the other one looks like: AccountEndpoint=https://account-name.documents.azure.com:443/ What is the standard way to get the second given we have first one stored in our secret? (For all clouds) Is string replace reliabe to convert `table.cosmos` part to `documents`? – Sayantan Ghosh Jul 15 '20 at 16:45