nerdexam
Microsoft

AZ-204 · Question #478

You develop Azure solutions. You must connect to a No-SQL globally-distributed database by using the .NET API. You need to create an object to configure and execute requests in the database. Which…

The correct answer is B. client = CosmosClient(endpoint, key). CosmosClient has to be created before you can do option A and C to create databases and execute requests. client = CosmosClient(endpoint, key) database_name = 'MyDatabase' database = client.create_database_if_not_exists(id=database_name) container_name = 'MyContainer' container…

Submitted by katya_ua· Mar 30, 2026Develop for Azure storage

Question

You develop Azure solutions. You must connect to a No-SQL globally-distributed database by using the .NET API. You need to create an object to configure and execute requests in the database. Which code segment should you use?

Options

  • Adatabase_name = 'MyDatabase'
  • Bclient = CosmosClient(endpoint, key)
  • Ccontainer_name = 'MyContainer'

How the community answered

(38 responses)
  • A
    16% (6)
  • B
    79% (30)
  • C
    5% (2)

Explanation

CosmosClient has to be created before you can do option A and C to create databases and execute requests. client = CosmosClient(endpoint, key) database_name = 'MyDatabase' database = client.create_database_if_not_exists(id=database_name) container_name = 'MyContainer' container = database.create_container_if_not_exists( id=container_name, partition_key=PartitionKey(path="/lastName"), offer_throughput=400 )

Topics

#Azure Cosmos DB#CosmosClient#.NET SDK#NoSQL

Community Discussion

No community discussion yet for this question.

Full AZ-204 Practice