Setting Partition Keys in Azure Cosmos DB

1.25 hours
  • 2 Learning Objectives

About this Hands-on Lab

In this lab, we provision a Cosmos DB account, learn how to create containers, populate a container with items, and set appropriate partition keys for our data.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Configure the Environment

For this first task, we need to provision a Cosmos DB account with the following parameters:

  • Core SQL API
  • (US) West US Region
  • Do NOT Apply the Free Tier Discount

Then open the GitHub link and review the table to determine possible keys:

Create a Container and Populate It
  • Create a new container with 1000 throughput and set "City" as a partition key.
  • Name the container testcontainer.
  • Populate the newly created container with the JSON file:
  • Once this is complete, create a second container with 1000 throughput and set "Test" as a partition key.
  • Populate this new container with the same JSON file.

Additional Resources

Scenario

We work for a growing chemical manufacturer with clients around the world. As a newly-appointed cloud architect, we have been asked to begin the movement of our company's data to Cosmos DB and develop key partitioning to optimize queries.

As a part of this initiative we need to do the following:

  • Provision a Cosmos DB account. This may take a while.
  • Review the given table to determine an appropriate key.
  • Create a new container.
  • Populate the new container with items.

Instructions

  • Provision a Cosmos DB account.
    • Core SQL API
    • (US) West US
  • Review the given table to determine an appropriate key.
    • Download this JSON link from GitHub https://gist.github.com/GaryMcLeary/07bdd715dd2dffec3ed1d35d1093923f
  • Create a new container.
    • 1000 throughput
    • Set "City"" as the partition key

For detailed instructions on how to complete these tasks, expand each learning objective below or click the Guide tab above the video player.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!