Hello Windows Azure



Demo ScriptHello Windows AzureLab version:1.0.0Last updated: DATE \@ "M/d/yyyy" 12/3/2009Prepared by:James ConardContents TOC \h \z \t "Heading 3,2,pp Topic,1,PP Procedure start,3" Overview PAGEREF _Toc247625219 \h 3Key Messages PAGEREF _Toc247625220 \h 3Key Technologies PAGEREF _Toc247625221 \h 3Time Estimates PAGEREF _Toc247625222 \h 4Setup and Configuration PAGEREF _Toc247625223 \h 4Task 1 –Run the dependency checker PAGEREF _Toc247625224 \h 4Demo Flow PAGEREF _Toc247625225 \h 5Opening Statement PAGEREF _Toc247625226 \h 6Step-by-Step Walkthrough PAGEREF _Toc247625227 \h 6Creating the Hello Windows Azure application PAGEREF _Toc247625228 \h 7Deploying the application PAGEREF _Toc247625229 \h 12Summary PAGEREF _Toc247625230 \h 20Known Issues PAGEREF _Toc247625231 \h 20 OverviewThis 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 a simple “Hello World” 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 MessagesIn this demo you will see three key things: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.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. Finally, you will see how to deploy, start, and manage a Windows Azure application through the Azure services Developer portal.Key TechnologiesThis demo uses the following technologies:.NET Framework 3.5 SP1Visual Studio 2008 SP1Windows Azure Tools for Microsoft Visual Studio November 2009 CTP (includes SDK)Time EstimatesEstimated time for setting up and configuring the demo: 10 minEstimated time to complete the demo: 5 minSetup and ConfigurationThis 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 checkerThe 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. Run the StartHere.cmd command script located in the directory that contains this demo. 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 use the Azure Services Platform Management Tools.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 FlowThe following diagram illustrates the high-level flow for this demo and the steps involved:Opening StatementIn the next 5 minutes we will build, debug, and deploy a simple “Hello World” Application using 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 you will see how we can build more complex applications that utilize additional roles, the Windows Azure APIs, and Windows Azure Storage services as well as additional services of the Azure Services Platform. In this simple, Hello World demo you will specifically see three key things: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.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. Finally, you will see how to deploy, start, and manage a Windows Azure application through the Azure services Developer portal.Step-by-Step WalkthroughThis demo is composed of the following segments:Creating the Hello Windows Azure applicationDeploying the applicationCreating the Hello Windows Azure applicationActionScriptScreenshotStart Visual Studio 2008Select File -> New ProjectSelect the Cloud Service project typeSelect the Windows Azure Cloud Service templateName the solution HelloAzureClick OK to launch a wizardFrom the wizard, add the Web Role in C#Select the added Role and click the edit icon.Rename from WebRole1 to HelloAzure_WebRoleLet’s launch Visual Studio 2008 and create a new projectIn this case I have installed the November CTP of the Windows Azure SDK and the Windows Azure Tools for Visual StudioNotice that we now have a new category of projects – Cloud ServicesWe have a new template called “Windows Azure Cloud Service”This template launches a wizard that allows us to select the type and programming language for a role within our project.Let’s name our new project HelloAzure and rename the WebRole1 to HelloAzure_WebRoleWait for the new solution to be createdDouble click on the Default.aspx page to open it in the design viewVisual Studio will now create a new solution This solution will contain two projectsThe first project named HelloAzure_WebRole is a standard projectThe second project is a new Cloud Service projectThis Cloud Service project references to our project. 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.Expand the ToolboxDrag and drop an Label ControlChange the Font->Size property for the new label to XX-LargeFirst, let’s build our HelloAzure web page.Let’s open the default web pageNow we’ll add a standard label control to our default page. Let’s go ahead and adjust the font size on the labelRight click on the design surface and select View Code from the context menu to view the Default.aspx.cs code behind file.Add code in the Page_Load event to set the text for the labelNow let’s add a bit of code to display the text “Hello Windows Azure” in the labelOpen the ServiceConfiguration.cscfg fileBefore we run this application, let’s take a look at the model that defines our Windows Azure application.Let’s navigate over to the HelloAzure Cloud Service project and open the ServiceConfiguration.cscfg file This configuration file defines the roles for our Windows Azure project. As you can see here, it also defines the number of instances per role. Let’s simply change the number of instances here to 2. Select Debug->Start DebuggingNow let’s start the application in debug mode or just press the familiar F5 button.NOTE: It will take 30-90 seconds until the devfabric starts.Once the devfabric starts, expand the HelloAzure application in the devfabric and expand the WebRoleSelect the WebRole and show the two instances that are runningThis will cause the project to be compiled into a .NET assembly, just as normal. However, since we have a Cloud Service project in our solution set as the startup project, 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 environmentHere you can see the Development Fabric UI. Notice that we have a new deployment containing our HelloAzure applicationIf we expand the WebRole for the HelloAzure application we can see that there are two instances for this role.Switch over to Internet Explorer to show the applicationHere we can see our simple web application and the text “Hello Windows Azure”Switch back to Visual StudioSet a breakpoint on the line that sets the label text.Let’s quickly switch back over to Visual Studio and set a breakpointSwitch back to Internet Explorer and refresh the page.Switch back to Visual Studio to see the breakpointPress F5 to continue executionNow let’s refresh the pageNotice that we can drop into Visual Studio to debug our project and step through lines of code – just as we normally do.Stop the application by closing Internet ExplorerDeploying the applicationActionScriptScreenshotSwitch back to Visual StudioRight click on the HelloAzure project and select Publish from the context menuSo you’ve seen how we can build and debug simple web applications for Windows Azure with the new Visual Studio extensions and the SDKNow let’s deploy our HelloAzure application to the cloudLet’s switch back to Visual StudioTo deploy our app, first let’s right click on the HelloAzure Cloud Service project and select PublishThis 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. Copy the path where the service package was published from the Windows Explorer address bar.Once the publish process is complete, Visual Studio will open the directory where the service package was createdIt will also launch the default browser and navigate to the Azure Services developer portalLet’s copy the path to this fileSwitch over to the browser window that was launched during the Publish processNow 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.Select the PDC08 CTP ProjectHere 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 projectClick on the New Service linkHere you can see the developer portal and the projects that I have already configured. Let’s create a new project.Click on the Hosted Services project typeNext we’ll select the type of project we want to create in the developer portal. In this case we want to deploy an application to run in Windows Azure, so we’ll select Hosted Service.Give the Service Label like Hello Azure.Press the Next button.Next let’s give our project a name.Enter a sub-domain name and press the Check Availability button.Continue this process until you find an available sub-domain.Press the Create button to create the new project.On the next step we can specify a sub-domain for the application.With the current CTP, your application will be hosted at Let’s enter a sub-domain name and check the availability.For this demo, we will just choose any datacenter, but in practice we can choose the geography for our app as well.Finally, let’s create the project in the Portal.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.Browse to the directory where you published the solution. For the App Package, browse or enter the full path to the HelloAzure.cspkg file. You can paste in the path you copied earlier.For the configuration file, browse or enter the full path to the ServiceConfiguration.cscfg file located in the same directory.Enter a label for the deployment, such as Hello Azure DemoClick the Deploy buttonOn the next page we can browse to the service package that we published from Visual StudioWe 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.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 PortalWait 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.Click the Run button to start the HelloAzure application.NOTE: This process will take anywhere from 3 – 10 minutes.Once the package is deployed, we can then start the HelloAzure 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. In the case of our HelloAzure application, as you can see we have two instances allocated for the WebRole.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.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.View the HelloAzure web site in the new browser windowClose the browser window.Here we can see our Hello Windows Azure 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.Click on the sync button between the Production and Staging environmentsYou will be prompted to confirm that you want to switch to the production environment. Press the OK button when prompted.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 sync button and confirm that we want to move the switch the staging environment with production. This can take a few minutes.You should now see that the production environment is running.Click on the Web Site URL below the Production environment.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.You should see the web page with the text Hello Windows Azure dialog.Finally, you can see that our simple, Hello Azure application is running in the production environment. Notice that the URL is the sub-domain on 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. SummaryIn this demo, you saw how we can easily build and debug web applications using the familiar 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 IssuesPlease 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. 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. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download