This repository contains sample code for the article How to model and partition data on Azure Cosmos DB using a real-world example. The code included in this sample is intended to further illustrate the concepts from the article.
- Visual Studio 2019 - You can download Visual Studio 2019 Community Edition here.
- Azure Cosmos DB Emulator - More information on how to install and use the Azure Cosmos DB emulator can be found here.
- Azure Storage Emulator - More information on how to install and use Azure Storage Emulator can be found here.
-
Clone this repository.
-
From Visual Studio, open the AzureCosmosDbBlogExample.sln file from the root directory.
-
In Visual Studio Build menu, select Build Solution (or Press F6).
-
Start Azure Storage Emulator.
-
Start Azure Cosmos DB Emulator.
-
Change the Azure Cosmos Database Name (Optional).
The Azure Cosmos DB Database Name defaults to MyBlog. If you want to change this you will need to update the name in both the BlogFunctionApp (local.settings.json) and the BlogWebApp (appsettings.json).
-
Set both projects BlogFunctionApp and BlogWebApp to startup when the solution runs.
Only the BlogWebApp project will start when you run the solution. To also get the Azure Function App BlogFunctionApp to start, right-click on the Solution and choose Set as Startup Project and then set both projects to start.
-
You can now run and debug the application locally by pressing F5 in Visual Studio.
-
You can register as any username to create a new user (this sample does not require a password for logins).
To login as the Blog Administrator, register and login as the username jsmith. The Admin username can be changed in the BlogWebApp appsettings.json file.