in dotnet/azure-functions/FunctionApp/Notes.cs [21:38]
static Notes()
{
System.AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;
var builder = new ConfigurationBuilder().AddEnvironmentVariables();
var root = builder.Build();
EndpointUrl = root["COSMOS_ENDPOINT"];
PrimaryKey = root["COSMOS_KEY"];
var client = CreateClient(EndpointUrl, PrimaryKey);
// Create the database if it does not exist
client.CreateDatabaseIfNotExistsAsync("Notes").Wait();
// Create the container if it does not exist.
client.GetDatabase("Notes").CreateContainerIfNotExistsAsync("Notes", "/id").Wait();
var database = client.GetDatabase("Notes");
Container = database.GetContainer("Notes");
}