Deploying an Azure Cosmos DB Instance

1 hour
  • 5 Learning Objectives

About this Hands-on Lab

As modern, cloud-based apps have evolved, they’ve required data storage to adapt with them. Often the exact schema needed is not known up front and will probably change over time. Services such as Azure Cosmos DB have risen to the challenge to meet this need, providing multi-model, globally distributed, efficient NoSQL databases. In this hands-on lab scenario, you are the DBA for Awesome Company. A new video game is in development that will require a cloud database backend. Your solution will need to have the ability to replicate globally as the game is released to new countries, maintain fast and consistent performance so that there is no game lag, and have guaranteed availability so players can game whenever they want. Performing the actions of this lab will help you become familiar with how to deploy Azure Cosmos DB.

**Note:** *It will take a significant amount of time for the deployment to finish. Please allot at least an hour for total lab time.*

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Log in to the Azure Portal

Log in to the Azure Portal using the provided credentials.

Create an Azure Cosmos DB Account
  1. Click the three-line menu icon in the top left corner of the page, and click Azure Cosmos DB.
  2. Click Add.
  3. Select the resource group the lab created for you.
  4. Provide an account name (must be unique).
  5. For API, leave it as Core(SQL).
  6. For Apply Free Tier Discount, click Do Not Apply.
  7. For Location, select the region (US) West US.
  8. Leave all the other values at their defaults, and click Review + create.
  9. Verify all is well, and click Create.
  10. Once the deployment is complete, click Go to resource.

Note: The deployment could take up to 15 minutes. Feel free to carry out other tasks while you wait. Also, at times the deployment screen does not accurately report that it is finished. To mitigate this, check the status on the resource’s overview page.

Create the Database and Container
  1. Click on Data Explorer in the left-hand menu.
  2. Click New Container.
  3. Enter the following values:
    • Database id: Players
    • Container id: Profiles
    • Partition key: /team
  4. Leave all other values at their defaults, and click OK.
Add Items to the Database
  1. Expand the Players database, expand Profiles, and click on Items.

  2. Click New Item.

  3. Enter the following text into the document area on the right:

    {
        "id": "1",
        "team": "blue",
        "gamerTag": "Lando Commando",
        "statusMessage": "glhf :)",
        "isOnline": true
    }
  4. Click Save.

  5. Repeat the above steps with the following values:

    • id: 2
    • team: red
    • gamerTag: delmarDB
    • statusMessage: select * from victory
    • isOnline: false
Query the Items
  1. By default, all your items are selected.

  2. Click Edit Filter.

  3. Replace the default query with the following:

    WHERE c.team = 'red'
  4. Notice only our red team member is returned.

Additional Resources

You are the DBA for Awesome Company. A new video game is in development that will require a cloud database backend. Your solution will need to have the ability to replicate globally as the game is released to new countries, maintain fast and consistent performance so that there is no game lag, and have guaranteed availability so players can game whenever they want.

Note: It will take up to 15 minutes for the deployment to finish. Please allot at least an hour for lab completion. Also, at times the deployment screen does not accurately report that it is finished. To mitigate this, check the status on the resource's overview page.

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!