Sayantan Ghosh
Sayantan Ghosh

Reputation: 1056

The connection string is missing a required property: AccountEndpoint error while using the new CosmosClient(CosmosConnectionString)

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/;

Upvotes: 5

Views: 9386

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136366

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.

Upvotes: 2

Related Questions