windows azure using blobs demo -...

15

Click here to load reader

Upload: vuthuy

Post on 10-May-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Windows Azure using Blobs Demo - bandgap.cs.rice.edubandgap.cs.rice.edu/classes/comp410/resources/Using...  · Web viewIn this demo you will examine how blob storage is used within

Demo ScriptUsing BlobsLab version: 2.0.0

Last updated: 5/8/2023

Contents

Page 2: Windows Azure using Blobs Demo - bandgap.cs.rice.edubandgap.cs.rice.edu/classes/comp410/resources/Using...  · Web viewIn this demo you will examine how blob storage is used within

OVERVIEW................................................................................................................................................. 3Key Messages......................................................................................................................................... 3

Key Technologies.................................................................................................................................... 3

Time Estimates........................................................................................................................................ 4

SETUP AND CONFIGURATION................................................................................................................. 4

DEMO FLOW.............................................................................................................................................. 5

OPENING STATEMENT............................................................................................................................. 5

STEP-BY-STEP WALKTHROUGH.............................................................................................................6Uploading pictures to blob storage..........................................................................................................6

Viewing the blobs using the Azure Storage Explorer tool........................................................................9

SUMMARY................................................................................................................................................ 10

KNOWN ISSUES...................................................................................................................................... 11

Page 3: Windows Azure using Blobs Demo - bandgap.cs.rice.edubandgap.cs.rice.edu/classes/comp410/resources/Using...  · Web viewIn this demo you will examine how blob storage is used within

Overview

This document provides setup documentation, step-by-step instructions, and a written script for showing a demo of Windows Azure. This document can also serve as a tutorial or walkthrough of the technology. In this demo, you will show how you can use blob storage to store images, what configuration is required, and how you can use the Sample PowerShell provider to view and navigate blob storage. For additional demos of the Azure Services Platform, please visit http://www.azure.com.

Note: This demo uses the local developer fabric only. You do not need an account for the cloud

Key Messages

In this demo you will specifically see three key things:

1. First, you will see the configuration required to access Blob Storage using the Developer Storage service.

2. Second, you will see how to write code that connects to and creates new contains and blobs.

3. Finally, you will use the Windows PowerShell sample provider to view the blobs stored in the local Developer Storage.

Key Technologies

This demo uses the following technologies:

1. .NET Framework 4.0

2. Visual Studio 2010

3. Windows Azure SDK

4. Windows Azure Tools for Microsoft Visual Studio

Page 4: Windows Azure using Blobs Demo - bandgap.cs.rice.edubandgap.cs.rice.edu/classes/comp410/resources/Using...  · Web viewIn this demo you will examine how blob storage is used within

5. Windows Azure Services

Time Estimates

Estimated time for setting up and configuring the demo: 10 min

Estimated time to complete the demo: 10 min

Setup and Configuration

This demo does not have any advanced configuration requirements. You simply need to have the prerequisites installed and have a developer account for Windows Azure.

The following steps describe how to run the Dependency Checker utility included with the demo to verify that you have the prerequisite components. You can skip this exercise if you are confident that the pre-requisites are properly installed and configured.

1. Open a Windows Explorer window and browse to the demo’s Source\Script folder.

2. Double-click the Dependencies.dep file in this folder to launch the Dependency Checker tool and install any missing prerequisites.

3. If the User Account Control dialog is shown, confirm the action to proceed.

Note: This process may require elevation. The .dep extension is associated with the Dependency Checker tool during its installation. For additional information about the setup procedure and how to install the Dependency Checker tool, refer to the Setup.docx document in the Assets folder of the training kit.

Page 5: Windows Azure using Blobs Demo - bandgap.cs.rice.edubandgap.cs.rice.edu/classes/comp410/resources/Using...  · Web viewIn this demo you will examine how blob storage is used within

Demo Flow

The following diagram illustrates the high-level flow for this demo and the steps involved:

Figure 1Demo Flow

Opening Statement

In the next few minutes, we will look at how you can use blob storage to store photographs. Once again, we’ll use the GuestBook demo application, and review the code already implemented and working.

In this demo you will specifically see three key things:

1. First, you will see the configuration required to access Blob Storage using the Developer Storage service.

Page 6: Windows Azure using Blobs Demo - bandgap.cs.rice.edubandgap.cs.rice.edu/classes/comp410/resources/Using...  · Web viewIn this demo you will examine how blob storage is used within

2. Second, you will see how to write code that connects to and creates new contains and blobs.

3. Finally, you will use the Windows PowerShell sample provider to view the blobs stored in the local Developer Storage.

Step-by-Step Walkthrough

This demo is composed of the following segments:

Uploading pictures to blob storage.

Viewing the Blobs using the Powershell provider

Uploading pictures to blob storage

Action Script Screenshot

1. Start Visual Studio 2010

2. Select File -> Open Project

3. Select GuestBook.sln

Let’s Open an existing Windows Azure project.

In the following demos we are going to use the Guestbook application.

The Guestbook application is a simple application that exercises many features of the Windows Azure platform.

Page 7: Windows Azure using Blobs Demo - bandgap.cs.rice.edubandgap.cs.rice.edu/classes/comp410/resources/Using...  · Web viewIn this demo you will examine how blob storage is used within

4. Once the solution is open, point out the projects:

a. GuestBook_Data contains the classes for the data entities used by table storage

b. GuestBook is the cloud project. This is what defines the structure of the cloud solution, which roles are present and any service configuration.

c. GuestBook_WebRole is the asp.net project for the web role

d. GuestBook_WorkerRole is the worker role, written in VB.

As you can see we have several projects

Most of the projects are simply either standard class libraries, or asp.net web sites.

The important project for us is GuestBook

This defines the structure of our service.

You can see it has 2 roles, GuestBook_WebRole provides the web role, and GuestBook_WorkerRole provides the worker role.

For this demo we’ll be looking at the WebRole and the GuestBook_WebRole ASP.NET project

5. Open the ServiceConfiguration.cscfg file.

The Guestbook application uses blob storage to store the photographs that are uploaded.

WebRole and WorkerRole are configured to use development storage.

Page 8: Windows Azure using Blobs Demo - bandgap.cs.rice.edubandgap.cs.rice.edu/classes/comp410/resources/Using...  · Web viewIn this demo you will examine how blob storage is used within

6. Hit F5 to execute the application.

7. Right click on the development fabric icon in the system tray and click “Show Development Storage UI”

If we take a look at the local Development Storage, we can see the endpoints for the 3 storage services.

The UI also allows us to restart the development storage, as well as “Reset” the storage.

Resetting the storage clears the contents, which is useful for testing.

You can also stop and start the services, which again is useful for testing error handling and failures.

8. Highlight the BlobStorage code shown. (Default.aspx.cs – line 89)

Now let’s take a look at the code that implements the blob storage.

The CloudStorageAccount method, reads and parses the storage account information from the configuration we saw earlier.

Next we must make sure the container exists.

We can do this by calling GetContainerReference and passing in the name of the container and then using CreateIfNotExists method.

Page 9: Windows Azure using Blobs Demo - bandgap.cs.rice.edubandgap.cs.rice.edu/classes/comp410/resources/Using...  · Web viewIn this demo you will examine how blob storage is used within

9. Highlight the container code. Note the container has no metadata (null) associated, and is specified as Public. Public means you can access to contents without the sharedkey (meaning you can hit it with a simple URL). Writing still requires the sharedkey.

10. Highlight the code shown (Default.aspx.cs – line 37)

Now we have the container, we need to create the blob for the image.

First we need to ensure the filename is unique. For this demo, we use a combination of the word image and a guid to guarantee uniqueness.

This UniqueBlobName is then used to create some BlobProperties. The BlobProperties are used when creating the actual blob.

11. Highlight the code shown Based on the content type of the incoming file, we set the same content type on the blob properties

12. Highlight the code shown Finally, we can upload the file content to blob.

Page 10: Windows Azure using Blobs Demo - bandgap.cs.rice.edubandgap.cs.rice.edu/classes/comp410/resources/Using...  · Web viewIn this demo you will examine how blob storage is used within

13. Switch to your browser (GuestBook application).

14. Write a message, add a name, and choose a photo.

15. Click pencil icon.

16. After a short amount of time the image should be shown correctly.

Let’s run the GuestBook, and upload a picture.

Lets add a quick message and upload an image to blob storage.

We can then use Powershell to view the blob.

Viewing the blobs using the Azure Storage Explorer tool

Action Script Screenshot

1. Download and install Azure Storage Explorer.

2. Open and configure the development storage account.

Now let’s go and view that blob in the local storage using Azure Storage Explorer.

Azure Storage Explorer is a useful GUI tool for inspecting and altering the data in your Azure cloud storage projects.

After installation, we need to configure the local storage account.

Page 11: Windows Azure using Blobs Demo - bandgap.cs.rice.edubandgap.cs.rice.edu/classes/comp410/resources/Using...  · Web viewIn this demo you will examine how blob storage is used within

3. Go to configured account.

4. Navigate to Blob Containers

We can see the blob containers, queues and tables created by GuestBook.

Guestbookpics is the container used by the GuestBook.

5. Select the blob ending with thumb.jpg

Lets view the contents of this container

We can now see all the blobs stored in this container.

Summary

In this demo, you saw how you can use the Storage Client assembly to create containers and blobs. You also saw how you can use the Azure Storage Explorer to view data from blob storage.

Known Issues

Please note the following known issues with this demo:

Page 12: Windows Azure using Blobs Demo - bandgap.cs.rice.edubandgap.cs.rice.edu/classes/comp410/resources/Using...  · Web viewIn this demo you will examine how blob storage is used within

If the Developer Storage is not shown in the system tray, try running the GuestBook application, or launching the service from the start menu.