image
Getting Started With Blobs
Start course
Difficulty
Intermediate
Duration
1h 18m
Students
145
Description

Course Description

This course teaches you how to work with Azure Storage and its associated services.

Course Objectives

By the end of this course, you'll have gained a firm understanding of the key components that comprise the Azure Storage platform. Ideally, you will achieve the following learning objectives:

  • How to comprehend the various components of Azure storage services.
  • How to implement and configure Azure storage services. 
  • How to manage access and monitor your implementation. 

Intended Audience

This course is intended for individuals who wish to pursue the Azure 70-532 certification.

Prerequisites

You should have work experience with Azure and general cloud computing knowledge.

This Course Includes

  • 1 hour and 17 minutes of high-definition video.
  • Expert-led instruction and exploration of important concepts surrounding Azure storage services.

What You Will Learn

  • An introduction to Azure storage services.
  • How to implement Azure storage blobs and Azure files.
  • How to implement storage tables.
  • How to implement storage queues.
  • How to manage access and monitor storage.
  • How to implement SQL databases.  
Transcript

Hello, and welcome back. We're now getting to the technical aspects of development using blobs. First, we'll give an outline of the available options for working with blobs, this will include the software development kits available, and the supporting development tools. We'll then move on to describe the features provided within Visual Studio to support development with Blobs. We will finally cover some technical details including the use of access keys to allow you to programmatically access Blob storage, and describe the simple ways of manipulating the objects held in Blob storage.

Accessing Blob storage is ultimately done through a REST API which can be used from any platform, from anywhere on the internet using HTTP. There are several SDKs that have been developed that wrap-caused this API. These include options for F#, C#, Node, Java, C++, etc, etc. In this course, we will be using the .NET SDK, and programming in C#. We will be using Visual Studio as a development tool. This has a number of supporting features to help debug our applications that uses Azure, and also includes Cloud Explorer. Which enables us to examine the contents of the data held in Azure. The .NET SDK also provides the Azure Storage Emulator. Which allows us to develop against data held locally, that precisely mimics the structure and behavior of data held in Azure.

Access to Blob storage is controlled using an access key that you need to include in your config file. The SDK provides a full range of functionality, including the ability to create containers. Upload and download blobs, list blobs, and delete containers and blobs. We'll first need to update a configuration file for the application. You need to add the connection string for the storage account you're using.

In this example, we're adding a reference to the movies9 storage account. Here, the account key is truncated as it's very long. The required connection string can simply be copied from the Azure portal. Secondly, you need to add a reference to the main client library for storage. That is WindowsAzure.Storage. To get code to read the configuration file, you need to reference the supporting library, Microsoft.WindowsAzure.ConfigurationManager. You would, of course, typically do this using NuGet. Finally, you need to add the relevant using statements at the top of your code. For the configuration library, you need to add using Microsoft.Azure.

To access the storage, and more specifically to use the code to work with blobs. You need to add the using statements for Microsoft.WindowsAzure.Storage and Microsoft.WindowsAzure.Storage.Blob. To work with storage and blobs, you need to first read the configuration file, and get the connection string, and create a storage account variable. You can then use this variable to create another variable to read blob storage. Using this you can then access containers and individual blobs. In the above sample we are accessing the movies9 storage account, and within blob storage referencing the scifi container, and the blob, TotalRecall.AVI within that container.

In this demonstration, we'll illustrate how to start C# coding for blobs. First of all, we'll need to create a consult application in Visual Studio. We'll call it, "UploadBlob". Then, you can right-click on the project, and select, "Manage NuGet packages". In the NuGet Package Manager, select the "Browse" option, and then type "WindowsAzure" to search for the required packages. And then, install WindowsAzure.Storage, and Microsoft.WindowsAzure.ConfigurationManager.

Now, you'll have to edit the app config file. Add an app setting element, and include a new key of storage connection string. With a value of the storage account details we were using. You can get the required string to use, by going to the Azure portal, selecting "Storage account", and the "Access keys" option, and copying the key. Now, we can add the required using statements at the top of the page. We can then add standard code to access the storage account. In this case, we'll just upload a file into a blob. For this, we simply use the UploadFromFile method.

We can then easily write code to list the contents of a container. This code just prints out the size and address of blobs, and page blobs. And, the directories in a container. We can also simply create a sample application to delete a blob, using the delete method. Note, this code deletes the blob containing TotalRecall.AVI.

A final simple application we can create just illustrates how to download a blob using the download to file method. Again, in this case, we use the blob containing TotalRecall.AVI. You can also use Visual Studio to explore the storage. This is available for the menu view Cloud Explorer. You can use this to view local storage in the development section. Once you have provided your Azure connection credentials. You can then see the items you've set up in Azure. For example, you can explore the contents of the scifi container within the movies9 storage account. There are also facilities to upload files, and to download and delete blobs. You also have a pane showing progress, the Microsoft Azure activity log.

This concludes this demonstration. But, stay tuned. Because in the next section, we'll start talking about the various blob types, meta data, and security.

About the Author

Isaac has been using Microsoft Azure for several years now, working across the various aspects of the service for a variety of customers and systems. He’s a Microsoft MVP and a Microsoft Azure Insider, as well as a proponent of functional programming, in particular F#. As a software developer by trade, he’s a big fan of platform services that allow developers to focus on delivering business value.