Lab 1: Windows Azure Virtual Machines Overview In this hands-on Lab, you will learn how to deploy a simple web page to a Web server hosted in Windows Azure and configure load balancing. Objectives In this hands-on lab, you will learn how to: Create a Web Farm using Windows Azure Management Portal Configure Load Balancing in IIS Exercise 1: Creating VMs for IIS In this exercise, you will learn how to create a Virtual Machine in Windows Azure. Then, you will configure an Internet Information Server adding roles to use later on in this lab. Task 1 - Creating IIS VMs In this task, you will provision a Virtual Machine and configure the Load Balancing to host a simple IIS web page. 1. Open Internet Explorer and browse https://manage.windowsazure.com/ to enter the Windows Azure portal. Then, log in with your credentials. 2. In the menu located at the bottom, select New Virtual Machine From Gallery to start creating a new virtual machine. 3. In the VM OS Selection page, click Platform Images on the left menu and select the Windows Server 2008 R2 SP1 OS image from the list. Click the arrow to continue. 4. In the VM Configuration page, select the latest release date then enter the Virtual Machine Name (something along the lines of <Your Initials>BaseVM; for me, that would result in a machine name of SPBaseVM ) the specify a USER NAME and be creative when creating a PASSWORD which needs to contain three of these - lower case characters, uppercase characters, numbers and special characters. Make sure you remember your choice. Select a Size of Small Instance then click the right arrow to continue. 5. In the second VM Configuration page ensure Create a new cloud service is selected in the CLOUD SERVICE dropdown. In CLOUD SERVICE DNS NAME create a unique DNS name. It is best not to align this with a machine name. You will add another machine to this DNS name later so a name such as iis.cloudapp.net is better than server1.cloudapp.net. Ensure your subscription is selected in the SUBSCRIPTION box. In the REGION/AFFINITY GROUP/VIRTUAL NETWORK dropdown, select the North Europe data center. In STORAGE ACCOUNT select Use an
automatically generated storage account and leave AVAILABILITY SET at the default value of None. Click the right-arrow button. 6. In the third VM Configuration page ensure that Remote Desktop and Powershell endpoints are defined, then click the Finish button to create a new VM. 7. In the Virtual Machines section, you will see the VM you created with a Starting (provisioning) status. Wait until it changes to Running in order to continue with the following step. It will take from 8 to 10 minutes for the Virtual Machine to complete the provisioning process. You will be able to start the next task but will get to a point where it is not possible to continue until the first VM has fully provisioned. Tip: You may find refreshing the page every couple of minutes will give a more accurate and up-to-date status of the state of the VM. 8. You will now add the second VM for the IIS Load Balancing. In the portal, select New Virtual Machine From Gallery. 9. In the VM OS Selection page, click Platform Images on the left menu and select the Windows Server 2008 R2 SP1 OS image from the list. Click the arrow to continue. 10. In the VM Configuration page, select the latest release date then enter the Virtual Machine Name (something along the lines of <Your Initials>BaseVM2; for me, that would result in a machine name of SPBaseVM2 ) and be creative when creating a password which needs to contain three of these - lower case characters, uppercase characters, numbers and special characters. Make sure you remember your choice. Select a Size of Small Instance then click the right arrow to continue. 11. In the second VM Configuration page, in the CLOUD SERVICE dropdown, select the cloud service you created when you created the first VM. The CLOUD SERVICE DNS NAME should be disabled and already populated with your service name. Ensure your subscription is selected in the SUBSCRIPTION box if you have one (this box appears only if you have multiple subscriptions). In the REGION/AFFINITY GROUP/VIRTUAL NETWORK dropdown, select the North Europe data center. In STORAGE ACCOUNT select the automatically generated storage account you created when building the first VM and leave AVAILABILITY SET at the default value of None. Click the right-arrow button. 12. In the third VM Configuration page ensure that Remote Desktop and Powershell endpoints are defined, then click the Finish button to create the second VM. 13. In the Virtual Machines section, you will see the VM you created with a Starting (provisioning) status. You now have 2 VMs in the provisioning process this will take 8-10 minutes. Tip: You may find refreshing the page every couple of minutes will give a more accurate and up-to-date status of the state of the VM. 14. After creating the second VM, you will wait until the first VM goes in to the running state then create an endpoint on port 80 of the first Virtual Machine you created. To do this, click on the first VM Name (<YourInitials>BaseVM) to go to the summary page and then click ENDPOINTS. 15. Click Add Endpoint on the bottom pane. Make sure that ADD STANDALONE ENDPOINT is selected and then click the right arrow button to continue. 16. In the Specify details of the endpoint page, set the Name to HTTP, the Protocol to TCP and the PUBLIC PORT and PRIVATE PORT to 80. Select the CREATE A LOAD_BALANCED SET check box then click the right arrow button.
17. In the Configure the load-balanced set page, in the LOAD_BALANCED SET NAME box, type HTTPLB (HTTP Load Balanced) and leave the other fields at their default value then click the finish button. You may need to switch back to the VMs view to see if the update has actually completed. 18. At this point you may have provisioning still in progress for the second VM and the endpoint. While this is happening, you may want to save time by advancing to Task 2 to configure IIS for both VMs and then come back to this step. Make sure you note where to come back to in these lab instructions. 19. Now, create a new Endpoint in the second VM in order to enable Load Balancing between both VMs. To do this, click Virtual Machines and then select the second VM you created. Then, click Endpoints. 20. Click Add Endpoint, select ADD AN ENDPOINT TO AN EXISTING LOAD BALANCED SET then select the endpoint you created for the first VM from the drop down list and then click the right arrow to continue. 21. In the New Endpoint Details page, set the Name to HTTP and the Public and Private Ports to 80. Click the button to create the endpoint. It will take some minutes to create a new endpoint. 22. In the Virtual Machines section, click on the first VM Name (<YourInitials>BaseVM) and then click Endpoints. 23. Select the HTTP endpoint you have created. Make sure the LOAD_BALANCED SET NAME column value is set to the same value for both VMs. Task 2 - Configuring IIS VMs In this task, you will configure the IIS VMs by adding the necessary roles to deploy the simple web page 1. In the Portal, click Virtual Machines on the left menu. 2. You will see a list with your existing VMs. Select the first one you created in Task 1 and click Connect (<YourInitials>BaseVM). 3. You will be asked to download the remote desktop client. Click Open and log on using the Admin credentials you defined when creating the VM. Word of Warning: You might get an error suggesting the domain name is wrong. This is where the RDP client has cached a machine or domain name from a previous log on. In that case, specify.\<user-id> (where <user-id> is the user you created when creating the VM. 4. In the Azure VM, open Server Manager from Start All Programs Administrative Tools. 5. In the Server Manager window, select Roles node. 6. Click Add Roles link. 7. The Add Roles Wizard will appear. 8. In the Before you Begin page, read the content and click Next. 9. In Select Server Roles page, check the Application Server and Web Server (IIS). A warning will show, informing the Required Role Services that are missing. Click Add Required Features to install them and then click Next
10. The Application Server page provides a brief introduction about the Application Server's capabilities. Click Next when you complete reading it. 11. In the Select Role Services page for Application Server, make sure.net Framework 3.5.1 is selected then select Web Server (IIS) Support. It will prompt a dialog warning about missing Required Role Services. Click Add Required Role Services to install them and then click Next 12. The Web Server (IIS) page provides a brief introduction about Web Server (IIS) capabilities. Click Next when you have completed reading it. 13. The Select Role Services page for Web Server (IIS) page will display the selected role services that will be installed. Click Next. 14. In the Confirm Installation Selections page, make sure the displayed services that will be installed are the ones you have selected, and then click Install. It will take some minutes to complete the installation. Repeat this task on the second VM (<YourInitials>NextVM) to install IIS, starting from step 4. Also remember, if you skipped any of the endpoint configuration from step 18 in task 1, to go back and complete that. Exercise 2: Azure Load Balancing In this exercise, you will make a simple modification to the Default Web Site and work with some of your neighbours to see Windows Azure load balancing at work. Task 1 Modify the Default IIS WebSite. 1. Using the RDP client on the first VM, navigate to C:\Inetpub\wwwroot. 2. Open iisstart.htm with Notepad. 3. Modify the file to identify it as coming from the first VM for example add the bolded text shown below. </style> </head> <body> <div id="container"> This is VM1 <a href="http://go.microsoft.com/fwlink/?linkid=66138&clcid=0x409"><img src="welcome.png" alt="iis7" width="571" height="411" /></a> </div> </body> </html> 4. Exit and save the file.
5. Perform steps 1. To 4 on the second VM you created, identifying this file as coming from the second VM for example add text saying This is VM2. Task 1 Test Windows Azure Load Balancing. 1. On your client machine do the following: 2. In the Windows Azure portal, display the Virtual Machines pane. 3. Identify one of the VMs you have created and copy the DNS name in to the paste buffer. 4. Paste the DNS name in to the address bar of a new tab in Internet Explorer and refresh the display multiple times in Internet Explorer using Ctrl-F5. The best way to see loadbalancing working is to hold down CTRL-F5 for say 7-10 seconds and watch the different VMs servicing the request. Note: The maintenance of state across the VMs connected to the load balancer is the responsibility of the developer who writes the application. In this case the content on each web server is manipulated to identify the server. Normally the content and code would be identical. Task 2 De-provisioning. You will only delete the second VM. The first VM will be used as the base image for a SharePoint server in lab 4. 1. In the portal click the Virtual Machines section and select the second VM you created (<YourInitials>NextVM). 2. Click Delete at the bottom of the page. You will see a message saying the operation will delete the VM but will retain the associated disks in your storage account. Click Yes. 3. The status will change to Running (Deleting). You may need to refresh the browser with CTRL-F5 to see an accurate status for the VM.