Skip to content
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

services platforms author

Developing a .NET console app using DocumentDB

This sample shows you how to use the Microsoft Azure DocumentDB service to store and access data from a .NET console application.

.NET Console application

For a complete end-to-end walkthrough of creating this application, please refer to the full tutorial on the Azure documentation page.

Running this sample

  1. Before you can run this sample, you must have the following prerequisites:
    • An active Azure DocumentDB account - If you don't have an account, refer to the Create a DocumentDB account article.
    • Visual Studio 2013 (or higher).

2.Clone this repository using Git for Windows (, or download the zip file.

3.From Visual Studio, open the GetStarted.sln file from the root directory.

4.In Visual Studio Build menu, select Build Solution (or Press F6).

5.Retrieve the URI and PRIMARY KEY (or SECONDARY KEY) values from the Keys blade of your DocumentDB account in the Azure Preview portal. For more information on obtaining endpoint & keys for your DocumentDB account refer to How to manage a DocumentDB account

If you don't have an account, see Create a DocumentDB database account to set one up.

6.In the App.config file, located in the src directory, find endpoint and authKey and replace the placeholder values with the values obtained for your account.

<add key="EndPointUrl" value="~your DocumentDB endpoint here~" />
<add key="AuthorizationKey" value="~your auth key here~" />

7.You can now run and debug the application locally by pressing F5 in Visual Studio.

About the code

The code included in this sample is intended to get you quickly started with a .NET console application that connects to Azure DocumentDB.

More information

You can’t perform that action at this time.