You need to connect to a globally distributed NoSQL database from .NET and create the object used to configure and execute requests against the database. Which code construct should you use?
Choose an answer
Tap an option to check your answer.
Correct answer: new CosmosClient(EndpointUri, PrimaryKey);.
Why this is the answer
The CosmosClient class is the correct construct for connecting to an Azure Cosmos DB account and configuring requests. It represents a client-side logical representation of the Azure Cosmos DB service, allowing you to interact with databases, containers, and items. EndpointUri specifies the URI of your Cosmos DB account, and PrimaryKey provides the necessary authentication. new Container(EndpointUri, PrimaryKey) is incorrect because Container represents a specific container within a database, not the top-level client for connecting to the service. You would obtain a Container object from a CosmosClient instance. new Database(EndpointUri, PrimaryKey) is incorrect because Database represents a specific database within a Cosmos DB account. Similar to Container, you would obtain a Database object from a CosmosClient instance.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed