azure Azure DocumentDB Connect to an account (.NET)


To connect to your DocumentDB database you will need to create a DocumentClient with your Endpoint URI and the Service Key (you can get both from the portal).

First of all, you will need the following using clauses:

using System;
using Microsoft.Azure.Documents.Client;

Then you can create the client with:

var endpointUri = "<your endpoint URI>";
var primaryKey = "<your key>";
var client = new DocumentClient(new Uri(endpointUri), primaryKey);