Developing a .NET Core console app using DocumentDB

Last updated: 19/03/2017
Edit on GitHub

This sample shows you how to use the Microsoft Azure DocumentDB service to store and access data from a .NET Core 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:
  2. An active Azure account. If you don't have one, you can sign up for a free account.
  3. Visual Studio 2015 Update 3 and .NET Core 1.0.1 - VS 2015 Tooling Preview 2

    • If you're working on MacOS or Linux, you can develop .NET Core apps from the command-line by installing the .NET Core SDK for the plaform of your choice.
    • If you're working on Windows, you can develop .NET Core apps from the command-line by installing the .NET Core SDK.
    • You can use your own editor, or download Visual Studio Code which is free and works on Windows, Linux, and MacOS.
  4. Clone this repository using Git for Windows (http://www.git-scm.com/), or download the zip file.

  5. If using the DocumentDB Emulator, please follow instructions at Azure DocumentDB Emulator to install and start the emulator.

If using your Azure DocumentDB account, please substitute the endpoint and authorization key in Program.cs with your account's details.

  1. From a command prompt or shell, run dotnet restore followed by dotnet run to run the sample.

About the code

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

More information