Exercise - Set up Azure Cosmos DB
This exercise provides an overview of setting up an Azure Cosmos DB account and database.
In this exercise, you:
- Create an Azure Cosmos DB account.
- Create an Azure Cosmos DB database.
Prerequisites
To perform this exercise, you need:
- An Azure subscription.
- A Microsoft account assigned to the Owner or Contributor role in the Azure subscription.
Create an Azure Cosmos DB account
Start a web browser, refer to the Azure portal, and sign in to access the Azure subscription you're using for this module.
Use the Search resources, services, and docs text box at the beginning of the Azure portal page to search for Azure Cosmos DB, and in the list of results, select Azure Cosmos DB.
On the Azure Cosmos DB pane, select + Create.
For Which API best suits your workload?, select Azure Cosmos DB for NoSQL and select Create.
On the Basics tab, configure the following settings:
Setting Configuration Subscription Select the name of the Azure subscription you're using in this module. Resource Group Create a new resource group named cosmos-db-RG. Account Name Specify a unique account name. Location Select the Azure region closest to the location of your lab environment. Capacity mode Select Provisioned throughput. Apply Free Tier Discount Select Apply if that option is available. Select the Backup Policy tab, and then specify the following settings:
Setting Configuration Backup interval 24 Hour(s) Backup retention 2 Day(s) Backup storage redundancy Locally-redundant backup storage Note
These choices don't represent the recommended settings, but are acceptable in a lab environment.
Select Review + create.
On the Review + create tab, select Create.
Note
Wait for the Azure Cosmos DB provisioning to complete. This might take about three minutes.
When the Azure Cosmos DB deployment status indicates success, select Go to resource.
Create an Azure Cosmos DB database
On the Azure Cosmos DB pane, in the vertical menu, select Data Explorer, select the New Container drop-down, and then select New Database.
On the New Database pane, specify the following settings, and then select OK.
Setting Configuration Database id iotdb Database throughput (autoscale) Autoscale Database Max RU/s 4000 In the DATA section, select the ellipsis icon next to the newly created database iotdb and select New Container.
On the New Container pane, specify the following settings, and then select OK.
Setting Configuration Database id Use existing - iotdb Container id iotcollection Partition Key /pk/timestamp/deviceid Keep all the web browser windows open. You'll use them in the next exercise of this module.
Results
Congratulations! You completed the first exercise of this module. In this exercise, you created a Cosmos DB account and database.