Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows...

29
Demo Script Building and Deploying a Service Lab version: 1.0.0 Last updated: 6/3/2022 Prepared by: David Aiken

Transcript of Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows...

Page 1: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

Demo ScriptBuilding and Deploying a ServiceLab version: 1.0.0

Last updated: 9/12/2023

Prepared by: David Aiken

Page 2: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

ContentsOverview 3

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

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

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

SETUP AND CONFIGURATION................................................................................................................. 4Task 1 –Run the dependency checker 4

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

OPENING STATEMENT............................................................................................................................. 6

STEP-BY-STEP WALKTHROUGH.............................................................................................................6Previewing the Guestbook solution on the local developer fabric............................................................6

Deploying the application....................................................................................................................... 10

SUMMARY................................................................................................................................................ 21

KNOWN ISSUES...................................................................................................................................... 21

Page 3: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

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 build, debug, and deploy an ASP.NET Application using Windows Azure and have the application running on the web in less than 5 minutes. For additional demos of the Windows Azure Platform, please visit http://www.azure.com.

Note: In order to run through this complete demo, you must have network connectivity and a Windows Azure developer account. To create a developer account, you need to sign-up for an invitation code and redeem the invitation code on the Azure Services Developer Portal located at: http://windows.azure.com/

Key Messages

In this demo you will see three key things:

1. First you will see how the Windows Azure SDK and Visual Studio Tools for Windows Azure provide development tools that enable a rich and familiar development experience for cloud applications.

2. Second you will see how Windows Azure abstracts you from the underlying infrascture and uses simple models to define the roles and number of instances for your application.

3. Finally, you will see how to deploy, start, and manage a Windows Azure application through the Azure services Developer portal.

Key Technologies

This demo uses the following technologies:

1. .NET Framework 3.5 SP1

Page 4: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

2. Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1

3. Windows Azure Tools for Microsoft Visual Studio November CTP or later

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 pre-requisites installed and have a developer account for Windows Azure.

Task 1 –Run the dependency checker

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

1. Run the StartHere.cmd command script located in the directory that contains this demo.

2. The StartHere.cmd script will launch the Configuration Wizard. The Configuration Wizard is designed to check your machine to ensure that it is properly configured with all of the dependencies to build and run the demo.

Page 5: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

3. Click through the steps in the Configuration Wizard. The Required Software step will perform the actual scan of your machine. If you do not have the necessary dependencies, then install them using the links provided by the dependency checker and rescan your machine.

Demo Flow

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

Open the Guestbook Project

Show the Cloud Project and Role Links

Execute the Service on the local developer

fabricUpload a Picture

publish the projectCreate a Storage Account

Create a Compute Account

update the service configuration to use

the new storage account

Deploy the service to the cloud Start the application Switch the application

to production.

Page 6: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

Opening Statement

In the next 10 minutes, we will deploy a simple ASP.NET Application to Windows Azure. I want to show you a simple demo, so you can get a feel for the concepts and steps involved with building a Windows Azure application using the November CTP. In later demos, we’ll look at how the application was put together.

In this demo you will specifically see three key things:

1. First you will see how the Windows Azure SDK and Visual Studio Tools for Windows Azure provide development tools that enable a rich and familiar development experience for cloud applications.

2. Second you will see how Windows Azure abstracts you from the underlying infrascture and uses simple models to define the roles and number of instances for your application.

3. Finally, you will see how to deploy, start, and manage a Windows Azure application through the Developer portal.

Step-by-Step Walkthrough

This demo is composed of the following segments:

Previewing the Guestbook solution on the local developer fabric

Deploying the application

Previewing the Guestbook solution on the local developer fabric

Action Script Screenshot

Page 7: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

1. Start Visual Studio 2008 or Visual Web Developer 2008 SP1

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.

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.

It also contains a configuration file that defines the model for our

Page 8: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

Windows Azure solution. We’ll take a look at this model in just a few minutes when we deploy the service.

5. Select Debug->Start Debugging Now let’s see what the guestbook service does before we deploy it to the cloud.

We can start the application in debug mode or just press the familiar F5 button.

Page 9: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

6. NOTE: It will take 30-90 seconds until the devfabric starts.

7. Once the devfabric starts, expand the GuestBook application in the devfabric.

8. NOTE: to show the dev fabric UI, you will have to right click the dev fabric tray icon and choose Show Developerment Fabric UI

This will cause the ASP.NET project to be compiled into a .NET assembly, just as normal.

However, since we have a Cloud Service project in our solution, this will then start the Windows Azure Development Fabric.

The Development Fabric, or simple devfabric, is a simulated environment for developing and testing Windows Azure applications on your machine.

You can think of this as a Cassini like environment

Here you can see the Development Fabric UI.

Notice that we have a new deployment containing our GuestBook application

If we expand the GuestBook1 application we can see that there are both a WebRole and Worker

Page 10: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

9. Switch over to Internet Explorer to show the application

10. Complete the fields, and choose an image to upload. Its good to choose a large hi-res image, because the guestbook service will resize it!

11. Click on the pencil icon.

Here we can see our simple ASP.NET web application

Lets add an entry.

Once we click the pencil icon, the details are added to a table, and the photo is uploaded to blob storage.

There is a update panel on the page, which will refresh every 5 seconds and display any new messages.

At first the image will appear the same size as I uploaded it

Page 11: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

But after a few seconds it will be resized.

What happened is when the image was uploaded a message with the location of the image was placed in a Queue, which was later read by the Worker Role.

The Worker role then resized the image to the correct size.

We’ll see how this is done in later demos

12. Stop the application by closing Internet Explorer

Deploying the application

Action Script Screenshot

Page 12: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

1. Switch back to Visual Studio

2. Right click on the GuestBook project and select Publish from the context menu

Now let’s deploy our GuestBook application to the cloud

Let’s switch back to Visual Studio

To deploy our app, first let’s right click on the GuestBook Cloud Service project and select Publish

This will compile and build the solution. It will also create a new service package, essentially a zip file, containing the assemblies and configuration files for the solution.

3. Switch over to the browser window that was launched during the Publish process

Now let’s login to the Azure Services management portal using our Live ID.

Previously, I have created a developer account in the Azure Services developer portal and I have redeemed an invitation code for Windows Azure. This invitation code gives me the ability to deploy new applications to Windows Azure or use Windows Azure Storage Services.

Page 13: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

4. Select the PDC08 CTP Project. Here you can see the developer portal that includes all the Windows Azure platform services linked to the navigation tab on the left here.

We need to select our PDC project

5. Click on the New Service link Here you can see the developer portal and the projects that I have already configured.

Let’s create a new Storage Account.

This Storage account will be used to storage the table and image data from the guestbook.

6. Click on the Storage Account project type

7. Enter the name of the storage project, name it <yournamegbstore>

8. Click Next

Lets call the storage demos storage

Page 14: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

9. Enter the same name as above

10. Click Check Availability. You should get a <yournamegbstore> is available. If not, choose a different name.

11. Create a new Affinity Group called Guestbook so that later we can associate the compute in the same location.

12. Click Create

Next we’ll specify the storage name. This will be the dns name for the storage endpoints. This must be unique, so that is why I’m using my name.

Clicking Check Availability will confirm no-one else has used that name.

Next, we will select our datacenter as anywhere, but create a new affinity group. We will use this later to make sure our data and web site are co-located.

Then we can create the storage account

13. Do NOTHING, but keep this open in the web browser.

Once the account is create we can view the storage endpoints as well as the shared keys required to access storage.

There are also options to change the keys, and delete the project.

Now that we have the storage account created, we have to update the configuration for the service we are about to deploy, so it uses the storage in the cloud, rather than the

Page 15: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

local developer storage.

14. Open the ServiceConfiguation.cscfg in notepad.

15. Locate the 2 sections that are currently commented out.

16. Put comments around the devstore account entries, or delete them

17. Copy the account name into the placeholder provided.

18. Copy the Primary Access Key into the placeholder provided

19. Repeat this for the worker role section of the serviceconfiguration.csfg file.

Flipping back to the folder with the 2 files, we can open the serviceconfiguration.cscfg file and enter the new storage details

All we need to do is to remove the configuration we had defined for the locat store,

And copy the settings from the web page

As a alternative, you can edit the original file in Visual Studio, then re-publish. Once you have the settings in the configuration file, you can also execute the service again, and use the service against the cloud storage. This is cool when you have time as once the app is deployed people will still see the original picture. You can also have people sign the guestbook in the cloud – and see those updates during the remaining sessions.

Page 16: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

20. Click on the New Service link

21. Click on Hosted Service.

Now we have the storage account and configuration updated, we can deploy the service to the cloud

We’ll create another new project, but this time it will be a hosted service.

22. Give the project a name <yournamegb>

23. Press the Next button.

Next let’s give our project a name.

24. Enter a sub-domain name such as <yournamegb> and press the Check Availability button.

25. Continue this process until you find an available sub-domain.

26. Select the “Use Existing Affinity Group” option and select the Guestbook affinity group created earlier.

On the next step we can specify a sub-domain for the application.

Let’s enter a sub-domain name and check the availability.

Next, we want to select our same affinity group we created earlier to ensure that our data and site are co-located.

Finally, let’s create the project in the

Page 17: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

27. Press the Create button to create the new project.

Azure Services Developer Portal.

28. Click on the Deploy button below Staging.

You can now see your new project in the developer portal.

Notice that with a Windows Azure project, there are two environments: Production and Staging.

Now let’s deploy our application into the staging environment.

29. Browse to the directory where you published the solution.

30. For the App Package, browse or enter the full path to the GuestBook.cspkg file.

31. For the configuration file, browse or enter the full path to the ServiceConfiguration.cscfg file located in the same directory.

32. Enter a label for the deployment, such as beta1

33. Click the Deploy button

On the next page we can browse to the service package that we published from Visual Studio

We also need to browse to the ServiceConfiguration file that was also published from Visual Studio. You might recall that this file defines the roles and number of instances per role.

Finally, we’ll give the deployment a label and start the deployment.

Page 18: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

34. Wait for the service package to be uploaded. Once it is uploaded, you will be redirected to the project details page.

At this point, the service package will be uploaded to the Azure Services Developer Portal

35. Wait until the package is has been deployed.

Once the package has been uploaded, the assemblies, ASPX pages, and configuration files will be extracted.

This can take a few minutes.

Page 19: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

36. Click the Run button to start the GuestBook application.

37. NOTE: This process will take anywhere from 3 – 10 minutes.

If you are presenting, you may wish to continue the presentation ,then return to this demo later

Once the package is deployed, we can then start the GuestBook application.

When we click the Run button, this is when the real magic happens.

At this point Windows Azure will start up virtual machine instances for each of the roles.

Once the instances are started, then our application – the assemblies, ASPX pages, etc. that we uploaded earlier – will be deployed into each of the instances.

This process will take a few mintues.

Page 20: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated
Page 21: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

38. Click on the Web Site URL for the Staging environment.

Once the application is running in staging, we can now access it using the temporary Website URL generated below.

39. View the GuestBook web site in the new browser window

40. Close the browser window.

Here we can see our GuestBook application running in Windows Azure – it’s publicly exposed on the web!

In fact, you could even access it now if you could enter this long, temporary web site URL.

Page 22: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

41. Click on the SWAP button between the Production and Staging environments

42. You will be prompted to confirm that you want to switch to the production environment. Press the OK button when prompted.

43. NOTE: This can take a few minutes to start the production environment.

Let’s close this window and go back to the Azure Services Developer Portal.

Let’s see how we can move our application from staging to production.

We’ll click on the swap button and confirm that we want to move the switch the staging environment with production.

This can take a few minutes.

44. You should now see that the production environment is running.

45. Click on the Website URL below the Production environment.

46. NOTE: It may take a few minutes for the DNS entries to be updated.

You can now see that the production environment is running.

Let’s now browse to our application running in production.

47. You should see the web page with any guestbook entries.

Finally, you can see that our simple, GuestBook application is running in the production environment.

Notice that the URL is the sub-domain on cloudapp.net that we specified when creating the project in the Azure Services Developer

Page 23: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

Portal.

If you have internet access you can browse to this site now.

Summary

In this demo, you saw how we can easily build & deploy applications using the familiar ASP.NET programming model and the new Windows Azure SDK and extensions to Visual Studio. You also saw how we can use the Azure Services Portal to create projects, deploy applications, and manage the staging and production environments. Finally, in less than 5 minutes we created and ran a new application in the cloud.

What you did not see is all of the infrastructure Windows Azure provided. For example, we didn’t worry about physical machines, rack space, network switches or connectivity. We also didn’t have to remote into machines and physically copy files across machines. Windows Azure abstracted us from the underlying infrastructure and provided the automated deployment, isolation, redundancy, and load balancing for our application. This was intentionally a simple demo to help you understand the concepts. In later demos you will see how we can build more complex applications that utilize additional roles, the Windows Azure APIs, and Windows Azure Storage services.

Known Issues

Please note the following known issues with this demo:

It can sometimes take several minutes to start a Windows Azure application in the cloud. Consequently, you may want to have an example application already deployed and running in the production environment.

Page 24: Windows Azure Guestbook Demoskydev.pha.jhu.edu/windowsazureplatformkit/demos... · Web viewWindows Azure abstracted us from the underlying infrastructure and provided the automated

With the current CTP version of Windows Azure you are limited to two instances of a role. If you configure a role to use more than two instances, you can run it in the development fabric. However, if you attempt to deploy the application using more than two instances to the cloud, you will receive an error during deployment.