Using Azure Storage Blobs with C#

1 hour
  • 2 Learning Objectives

About this Hands-on Lab

In this lab, you will gain experience using C# and Visual Studio to connect to and use Blob storage.

You will RDP into a Windows VM set up with Visual Studio and update a pre-built solution with the appropriate Blob storage C# code to connect to Blob storage, upload a blob, and retrieve the blob. Finally, you will run a console application to see everything working.

Upon completing the lab, you will have gained the experience required to work with Blob storage using C#.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

RDP into the VM and open the Visual Studio solution.

RDP login:

  UserName : "azureuser"
  Password : "LA!2018!Lab"

PowerShell to run:

Add-Type -Path "C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5System.IO.Compression.FileSystem.dll"

$url = "https://github.com/linuxacademy/content-azure-labs/blob/master/zips/Azure-LearningActivity-Blob.zip?raw=true"
$zipfile = "C:UsersazureuserDesktopAzure-LearningActivity-Blob.zip"
$folder = "C:UsersazureuserDesktop"

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -UseBasicParsing -OutFile $zipfile $url 

[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $folder)

Remove-Item -Path $zipfile 
Update Visual Studio solution and run the console app.

In this step, we’ll update our Visual Studio solution with the appropriate C# code to connect to, and interact with, the Blob service.

When we’re finished, we’ll run our completed console app, save and retrieve blobs, and verify the data was saved through the Azure portal.

Additional Resources

As a developer, you want to use the Azure Storage Blob SDK and C# code to connect to, and interact with, the Azure Blob service.

To do this, you will RDP into a virtual machine in Azure, download a pre-built solution, and fill in the correct C# code to get the program to compile. When you run the program, it will save and retrieve a blob from the Azure Blob service.

This activity gives step-by-step instructions for this lab. Follow along with those, and you will have successfully connected to and interacted with the Azure Blob service.

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?