Demo Script

Building and Deploying a Service

Lab version:1.0.0

Last updated:1/9/2019

Prepared by:David Aiken

Contents

Overview

Key Messages

Key Technologies

Time Estimates

Setup and Configuration

Task 1 –Run the dependency checker

Demo Flow

Opening Statement

Step-by-Step Walkthrough

Previewing the Guestbook solution on the local developer fabric

Deploying the application

Summary

Known Issues

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

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:

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
  2. Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1
  3. Windows Azure Tools for Microsoft Visual Studio NovemberCTP 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.
  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:

Opening Statement

In the next 10minutes, 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
  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.
/
  1. Once the solution is open, point out the projects:
  2. GuestBook_Data contains the classes for the data entities used by table storage
  3. GuestBook is the cloud project. This is what defines the structure of the cloud solution, which roles are present and any service configuration.
  4. GuestBook_WebRole is the ASP.NET project for the web role.
  5. 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 Windows Azure solution. We’ll take a look at this model in just a few minutes when we deploy the service.
/
  1. 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.
/
  1. NOTE: It will take 30-90 seconds until the devfabric starts.
  2. Once the devfabric starts, expand the GuestBook application in the devfabric.
  3. 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
/
  1. Switch over to Internet Explorer to show the application
  2. 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!
  3. 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
/
  • 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
/
  1. Stop the application by closing Internet Explorer

Deploying the application

Action / Script / Screenshot
  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.
/
  1. 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.
/
  1. 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
/
  1. Click on the New Servicelink
/
  • 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.
/
  1. Click on the Storage Accountproject type
  2. Enter the name of the storage project, name it <yournamegbstore>
  3. Click Next
/
  • Lets call the storage demos storage
/
  1. Enter the same name as above
  2. Click Check Availability. You should get a <yournamegbstore> is available. If not, choose a different name.
  3. Create a new Affinity Group called Guestbook so that later we can associate the compute in the same location.
  4. 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
/
  1. 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 local developer storage.
/
  1. Open the ServiceConfiguation.cscfg in notepad.
  2. Locate the 2 sections that are currently commented out.
  3. Put comments around the devstore account entries, or delete them
  4. Copy the account name into the placeholder provided.
  5. Copy the Primary Access Key into the placeholder provided
  6. 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. /
  1. Click on the New Service link
  2. 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.
/
  1. Give the project a name <yournamegb>
  2. Press the Next button.
/
  • Next let’s give our project a name.
/
  1. Enter a sub-domain name such as <yournamegb> and press the Check Availability button.
  2. Continue this process until you find an available sub-domain.
  3. Select the “Use Existing Affinity Group” option and select the Guestbook affinity group created earlier.
  4. Press the Create button to create the new project.
/
  • 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 Azure Services Developer Portal.
/
  1. 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.
/
  1. Browse to the directory where you published the solution.
  2. For the App Package, browse or enter the full path to the GuestBook.cspkg file.
  3. For the configuration file, browse or enter the full path to the ServiceConfiguration.cscfg file located in the same directory.
  4. Enter a label for the deployment, such as beta1
  5. 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.
/
  1. 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
/
  1. 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.
/
  1. Click the Run button to start the GuestBook application.
  2. 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.
/
  1. 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.
/
  1. View the GuestBook web site in the new browser window
  2. 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.
/
  1. Click on the SWAP button between the Production and Staging environments
  2. You will be prompted to confirm that you want to switch to the production environment. Press the OK button when prompted.
  3. 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.
/
  1. You should now see that the production environment is running.
  2. Click on the Website URL below the Production environment.
  3. 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.
/
  1. 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 Portal.
  • If you have internet access you can browse to this site now.
/

Summary