This module requires a sandbox to complete. A sandbox gives you access to free resources. Your personal subscription will not be charged. The sandbox may only be used to complete training on Microsoft Learn. Use for any other reason is prohibited, and may result in permanent loss of access to the sandbox.
In the sample scenario, you've decided to create the following data stores:
- A Cosmos DB for holding information about the volume of items in stock. You need to store current and historic information about volume levels, so you can track how levels vary over time. The data is recorded daily.
- A Data Lake store for holding production and quality data.
- A blob container for holding images of the products the company manufactures.
- File storage for sharing reports.
In this exercise, you'll provision and configure the Cosmos DB account, and test it by creating a database, a container, and a sample document. You'll also provision an Azure Storage account that can provide blob, file, and Data Lake storage.
You'll perform this exercise using the Azure portal.
Note
Azure can take as little as 5 minutes or as long as 20 minutes to create the Azure Cosmos DB account.
Provision and configure a Cosmos DB database and container
Create a Cosmos DB account
-
Sign in to the Azure portal.
-
From the left-hand navigation menu in the Azure portal, select Create a resource.
-
On the New page, select Azure Cosmos DB.
-
On the Create Azure Cosmos DB Account page, on the Basics tabs, enter the details of the account using the values in the following table, and then select Review + create:
TABLE 1 Field Value Subscription Concierge Subscription Resource Group [sandbox resource group] (this resource group will have been created for you in the sandbox) Account Name Enter a unique name, such as your initials, the date (in numeric format), and the text cosmosdbaccount. For example, jpws01012020cosmosdbaccount API Core (SQL) Location Accept the default location Capacity mode Provisioned throughput Apply Free Tier Discount Do Not Apply Account Type Non-Production Geo-Redundancy Disable Multi-region Writes Disable -
Wait while your settings are validated. If there's a problem, it will be reported at this stage, and you can go back and correct the issue.
-
Select Create. It can take 10 or 15 minutes to create the account.
Create a database and a container
-
In the Azure portal, in the left-hand navigation menu, select All resources, and then select your Cosmos DB account.
-
On the page for your Cosmos DB account, select Data Explorer.
-
On the Data Explorer page, select New Container.
-
In the Add Container dialog box, create a new container with the following values, and then select OK:
TABLE 2 Field Value Database ID Select Create new, and enter contosodb Provision database throughput Check Throughput Select Manual, and specify 400 RU/s (the default) Container ID productvolumes Partition key /productid (Each product will have a new level recorded each day. Partitioning by product ID enables you to quickly report how the levels for a product vary over time.) My partition key is larger than 100 bytes Leave unchecked -
In the Data Explorer window. Expand contosodb, expand productvolumes, and then click Items. The container should currently be empty.
-
Select New Item to create a new document.
-
Replace the text that appears in the document window with the following JSON document. This is an example document showing the amount of product 99 in stock on 01/01/2020.
JSON{ "productid": 99, "date": "01/01/2020", "in-stock": 500 }
-
Select Save. The document will be added to the container. The new document will have some additional fields that Cosmos DB uses to track and manage the document. You can ignore these fields for now.
You've now provisioned a new Cosmos DB account, and created a database and container.
Provision Azure Storage
Create an Azure Storage account for Data Lake Storage
-
On the left-hand navigation menu in the Azure portal, select Create a resource.
-
On the New page, select Storage account - blob, file, table, queue.
-
On the Create storage account page, on the Basics tabs, enter the details of the account using the values in the following table:
TABLE 3 Field Value Subscription Concierge Subscription Resource Group [sandbox resource group] Storage account Name Enter a unique name, such as your initials, the date (in numeric format), and the text storage. For example, jpws01012020storage Performance Standard Account kind Storage V2 (general purpose v2) Replication Read-access geo-redundant storage (RA-GRS) Access tier Hot -
Select Advanced. On the Advanced page, in the Data Lake Storage Gen2 section, select Enabled, and then select Review + create.
-
If your settings are validated correctly, select Create.
It takes approximately 15-20 seconds for the storage account to be provisioned.
Create a container for Data Lake storage
-
In the Azure portal, on the left-hand navigation menu, select All resources, and then select your storage account.
-
On the page for your storage account, under Data Lake Storage, select Containers.
-
On the Containers page, select + Container, and create a new container named productqualitydata. Leave the Public access level set to Private (no anonymous access), and then click Create.
-
When the container has been created, double-click the productqualitydata container.
-
On the productqualitydata page, click + Add Directory, and add a directory named plantA.
-
Add a second directory named plantB.
Contoso has two manufacturing plants named Plant A and Plant B. Other applications will upload manufacturing data from each of these plants to the appropriate directory for later analysis.
Create a container for Blob storage
-
In the Azure portal, on the left-hand navigation menu, select All resources, and then select your storage account.
-
On the Overview page, select Containers.
-
On the Containers page, select + Container, and create a new container named images. Set the Public access level to Blob (anonymous read access for blobs only).
Contoso will use this container to hold product images.
Note
The container created for Data Lake Storage will also appear in the Containers page. You could store image data in a Data Lake Storage container, but Contoso want to keep the images separate from product quality data.
Create a file share
-
On the storage account page, under File service select File shares.
-
On the File shares page, select + File share.
-
Create a new file share named reports. Leave the Quota empty.
-
On the File shares page, double-click the reports file share.
-
On the reports page, select + Add directory, and add a directory named manufacturing.
-
Add a second directory named complaints.
Contoso will use these directories to hold documents relating to the manufacturing process and customers' complaints. A user that has been granted access to the reports file share can upload and download files from these directories.