languages | products | page_type | description | ||||
---|---|---|---|---|---|---|---|
|
|
sample |
This sample shows you how to use the Azure Cosmos DB service to store and access data from a .NET console application. |
This sample shows you how to use the Azure Cosmos DB service to store and access data from a .NET console application.
For a complete end-to-end walkthrough of creating this application, please refer to the full tutorial on the Azure Cosmos DB documentation page.
-
Before you can run this sample, you must have the following prerequisites:
- An active Azure Cosmos DB account - If you don't have an account, refer to the Create a database account article.
- Visual Studio 2015 (or higher).
-
Clone this repository using Git for Windows (http://www.git-scm.com/), or download the zip file.
-
From Visual Studio, open the CosmosGettingStarted.sln file from the root directory.
-
In Visual Studio Build menu, select Build Solution (or Press F6).
-
Retrieve the URI and PRIMARY KEY (or SECONDARY KEY) values from the Keys blade of your Azure Cosmos DB account in the Azure portal. For more information on obtaining endpoint & keys for your Azure Cosmos DB account refer to View, copy, and regenerate access keys and passwords
If you don't have an account, see Create a database account to set one up.
-
In the App.config file, located in the src directory, find EndPointUri and PrimaryKey and replace the placeholder values with the values obtained for your account.
-
You can now run and debug the application locally by pressing F5 in Visual Studio.
The code included in this sample is intended to get you quickly started with a .NET console application that connects to Azure Cosmos DB.