Use Cloud Shell to Survey Azure Data Resources

45 minutes
  • 3 Learning Objectives

About this Hands-on Lab

Suppose you’re new to a tech team and you’ve just been given read access to the QA Azure subscription. You’re told to inventory the data resources in that environment and compare it to the official documentation maintained by the team to see how well the team is maintaining both the environment and the documentation. (Because every team loves to have the new person reporting in on their housekeeping. Not.) This beginner lab demonstrates 3 ways to review existing data platform resources in an Azure subscription: using Cloud Shell on the Azure portal to enter Azure CLI or PowerShell commands, or by navigating to dashboards within the Azure Portal. The code is provided for you to copy/paste, and no prior coding experience is required.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Survey Data Resources in the Portal by Resource Group
  1. Launch the Azure portal in a private browser window, and navigate to the lab-provided resource group to see the list of data resources.
  2. For each storage or database account/instance, review Essentials, Activity Log, and Access Control.
    • The latter 2 will be mostly empty — this is just to make you aware of these basic features.
  3. Within each account/instance, drill down on each container or database to explore further.
Survey Data Resources by Resource Group Using PowerShell
  1. Launch Cloud Shell.
  2. When prompted to initialize storage for Cloud Shell, select Advanced settings and add the storage account. (Do NOT select Create storage, yet; doing so will result in an error.)
    3 Use the same location as your lab provided resource group. For Storage account, do NOT use the existing storage account; you will probably receive an error, if you do. Select Create new and give the account a globally unique name using all lowercase letters and numerals.
  3. For File share, select Create new and give it any name (e.g., "mycloudshellfileshare"); this name does not need to be globally unique.
  4. Click Create storage
  5. Explore the menu bar to enlarge text and review help docs.
  6. Use PowerShell code to get resource groups in order to confirm the existence of lab-provided resources.
  7. Use PowerShell code to drill down on each container or database to explore.
Survey Data Resources by Resource Group Using Azure CLI
  1. In Cloud Shell, switch to the Bash terminal.
  2. Explore the menu bar to enlarge text and review help docs.
  3. Use Azure CLI code to get resource groups in order to confirm the existence of lab-provided resources.
  4. Use Azure CLI code to drill down on each container or database to explore.

Additional Resources

Log in to the Azure portal using the credentials provided on the lab page. Be sure to use an incognito or private browser window to ensure you're using the lab account rather than your own.


The solution videos demonstrate 3 scripts each for PowerShell and Azure CLI to help get you started on exploring resources in Azure using these 2 scripting languages. The scripts demonstrated are available below for you to copy/paste and to use as starting points for your own explorations.

PowerShell Scripts

  1. Run this script to get a simple list of resources:

    Get-AzResource | ft
  2. Run this script to return only a subset of resources:

    Get-AzResource -ResourceType Microsoft.Sql/servers/databases | fl
  3. Run this script to return a different subset of resources and a more robust list of properties:

    Get-AzResource -Name *cosmos* | fl -property * 

Azure CLI Scripts

  1. Run this script to get a simple list of resources:

    az resource list --output table
  2. Run this script to return only a subset of resources:

    az resource list --resource-type 'Microsoft.Sql/Servers/databases' --output table
  3. Run this script to return a different subset of resources using the query syntax:

    az resource list --query "[?contains(name, 'cosmos')]" --output yaml

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.

Sign In
Welcome Back!

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

Get Started
Who’s going to be learning?