Instantly share code, notes, and snippets.

Embed
What would you like to do?
Provision Azure Cosmos DB if needed
private async Task ProvisionDbIfNeeded()
{
await client.CreateDatabaseIfNotExistsAsync(new Database { Id = dbName });
await client.CreateDocumentCollectionIfNotExistsAsync(
UriFactory.CreateDatabaseUri(dbName),
new DocumentCollection { Id = collectionName }
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment