- Lab
- A Cloud Guru
Using Blob Storage from the Azure Cloud Shell
Azure blob storage can be used to store nearly any kind of data. It can provide a complex storage backend for applications as well as a simple location to store the contents of important files. In this lab, you will have the opportunity to work through the simple process of creating a blob to store a simple data file. You do not always need to interact with Azure using the Azure portal. You can do so using Bash, and Azure offers a bash interface called Azure Cloud Shell. You can use Azure Cloud Shell to interact with Azure from a command line in your browser. This lab will provide you with the opportunity not only to work with storage blobs but to work with them using Azure Cloud Shell.
Path Info
Table of Contents
-
Challenge
Create a storage account and configure authentication.
- Choose a storage account name. Include a unique string to ensure the name does not conflict with any existing storage account:
export AZURE_STORAGE_ACCOUNT="sattrecords<unique string>"
- Set an environment variable containing the resource group to be used in future commands. You can find the resource group name in the Azure portal:
export RESOURCE_GROUP="<resource group name>"
- Create the storage account:
az storage account create --name $AZURE_STORAGE_ACCOUNT --resource-group $RESOURCE_GROUP --location westus --sku Standard_LRS --encryption-services blob
- Get keys for the storage account:
az storage account keys list --account-name $AZURE_STORAGE_ACCOUNT --resource-group $RESOURCE_GROUP --output table
- Set an environment variable containing the storage account key so that future commands can authenticate:
export AZURE_STORAGE_KEY="<key>"
-
Challenge
Create a container.
Use the following command to create a container to contain the blob:
az storage container create --name records
-
Challenge
Upload the file as a blob and verify the data is stored in the blob
- Download the data file:
wget https://raw.githubusercontent.com/linuxacademy/content-azurestoragedd-lab-resources/master/satt-special-cars.csv
- Upload the data as a new blob:
az storage blob upload --container-name records --name cars --file satt-special-cars.csv
- List existing blobs and verify that your new blob appears in the list:
az storage blob list --container-name records --output table
- Download the blob data to a new file and check the file to verify that it contains the data:
az storage blob download --container-name records --name cars --file cars-dl.csv cat cars-dl.csv
What's a lab?
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.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.