Configuring Databases and Containers – Nonrelational Databases in Azure
Configuring Databases and Containers
After your Azure Cosmos DB account is deployed, you can start adding databases and containers to store data. You can add these objects using Azure PowerShell, Azure CLI, and Infrastructure as Code templates. There are also SDKs available in .NET, Java, Node.js, Python, and Xamarin that can be used to build Azure Cosmos DB objects. For the purposes of the DP-900 exam, let’s focus on configuring these objects using the following steps in the Azure Portal:
- Go to the Azure Cosmos DB page in the Azure Portal and click on the Azure Cosmos DB account you recently created.
- In the left-side panel of the Azure Cosmos DB blade, click Data Explorer. Figure 3.9 shows where this button is located.
- Data Explorer provides a web-based interface to interact with databases, containers, and items in Azure Cosmos DB. The splash page shows all the objects and data in that account, as well as some quick links to creating new tasks such as a new database. This page can be seen in Figure 3.10.
- To create a new database, click New Database under Common Tasks. The New Database page gives you the option to provision throughput using the autoscale or manual options, as well as the required number of RU/s if using manual or the max database RU/s if using autoscale. Figure 3.11 is an example of a new database using the autoscale option with a maximum RU/s allocation of 4000.
FIGURE 3.9 Azure Cosmos DB Data Explorer button
FIGURE 3.10 Azure Cosmos DB Data Explorer splash page
- To create a new container for that database, you can either click the New Container button in the upper-left corner of the Data Explorer page or you can click the ellipsis next to the database name and select New Container.
- The New Container page gives you several options for configuring your container. Along with selecting the database that will host the container, you can give the container a name and set a partition key. This page also allows you to set whether the container will use dedicated or shared throughput. When selected, the Provision dedicated throughput for this container check box will provision dedicated throughput for the container. Otherwise, the container will share throughput with the other containers hosted by the database. Figure 3.12 shows the configuration for a container that uses dedicated throughput.
- From here you can start adding new items to the container through Data Explorer or an application.
FIGURE 3.11 New Database