Cloud Zone is brought to you in partnership with:

My name is Bruno Terkaly and I am a Developer Evangelist in Northern California. Over the past few months I have been presenting a wide variety of demos and slides highlighting the wealth of new features in Visual Studio 2008. Bruno is a DZone MVB and is not an employee of DZone and has posted 47 posts at DZone. You can read more from them at their website. View Full User Profile

If You Can Do Just One Lab to Learn Windows Azure, This is It

02.20.2014
| 4761 views |
  • submit to reddit

Overview

Using Windows Azure as your Infrastructure as a Service (IaaS) platform, will enable you to create and manage your infrastructure quickly, provisioning and accessing any host ubiquitously. Grow your business through the cloud-based infrastructure, reducing the costs of licensing, provisioning and backup.

In this hands-on Lab, you will learn how to deploy a simple ASP.NET MVC 4 Web application to a Web server hosted in Windows Azure, using SQL Server and configuring load balancing.

This lab will appear at one of the Microsoft Windows Azure Developer Camps hosted throughout the United States by myself or another evangelist, such as the talented Bret Stateham.

hyperlink2  

Sign up here

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
  • Deploy a Simple MVC4 Application that consumes SQL Server Features
  • Create a Virtual Machine with SQL Server Full-Text Search feature to be consumed by the MVC Application

Prerequisites

The following is required to complete this hands-on lab:


Exercises

This hands-on lab includes the following exercises:

  1. Creating Virtual Machines for IIS
  2. Creating a SQL Server Virtual Machine
  3. Deploying a Simple MVC4 Application

Estimated time to complete this lab: 45 minutes.

Exercise 1: Creating Virtual Machines 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 Virtual Machines

In this task, you will provision a Virtual Machine and configure the Load Balancing to host an MVC4 application.

  1. Open Internet Explorer and browse to 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 | Compute | Virtual Machine | From Gallery to start creating a new virtual machine.

    creating-a-new-virtual-machine

    Creating a new Virtual Machine

  3. In the Virtual Machine 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 Virtual Machine Configuration page, leave the version release date by default (latest). Enter the Virtual Machine Name (i.e. "iisvm1"), provide a user name for the New User Name field and a password for the New Password and Confirm Password fields. This password needs to contain three of these – lower case characters, uppercase characters, numbers and special characters. Make sure you remember your choice. Lastly, set the Virtual Machine Size to Small and click Next to continue.

    creating-a-vm-configuration

    Creating a Virtual Machine - Configuration

    Note: It is suggested to use secure passwords for admin users, as Windows Azure virtual machines could be accessible from the Internet knowing just their DNS.

    You can also read this document on the Microsoft Security website that will help you select a secure password: http://www.microsoft.com/security/online-privacy/passwords-create.aspx

  5. In the Virtual Machine Mode page, select Standalone Virtual Machine, enter the DNS Name, select a Storage Account or leave the default value Use Automatically Generated Storage Account, and select a Region/Affinity Group/Virtual Network. Click the right arrow to continue.

    creating-a-vm-vm-mode

    Creating a Virtual Machine - Virtual Machine Mode

  6. In the Virtual Machine Options page, leave the default values and click the Finish button to create a new Virtual Machine.

    creating-a-vm--vm-options

    Creating a Virtual Machine - Virtual Machine Options

  7. In the Virtual Machines section, you will see the Virtual Machine you created with a Starting (provisioning) status. Wait until it changes to Running in order to continue with the following step as you will need a provisioned Virtual Machine on the following steps.

    creating-vm-for-iis-web-farm

    Creating Virtual Machine for IIS Web Farm

    Note: It will take from 8 to 10 minutes for the Virtual Machine to complete the provisioning process.

  8. You will now add the second Virtual Machine for the IIS Load Balancing. In the portal, select New | Compute | Virtual Machine | From Gallery.

  9. In the Virtual Machine OS Selection page, click Platform Images on the left menu and select the Windows Server 2008 R2 SP1, February OS image from the list. Click the arrow to continue.

  10. In the Virtual Machine Configuration page, set the version release date to February 12, 2013. Enter the Virtual Machine Name (i.e. "iisvm2"), a User Name, a Password and the Size. Click the right arrow to continue.

  11. In the Virtual Machine Mode page, select Connect to existing Virtual Machine and choose the first virtual machine you created from the drop down list. Select a Storage Account or leave the default value Use Automatically Generated Storage Account and click the right arrow to continue. This step adds the new virtual machine to the cloud service created in the previous step. This allows the virtual machines to be on the same network.

    creating-a-vm-vm-mode2

    Creating a Virtual Machine - Virtual Machine Mode

  12. In the Virtual Machine Options page, leave the default values and click the button to create a new Virtual Machine.

  13. Wait until the second Virtual Machine is created. You can check the Virtual Machine status from the Virtual Machines section within the portal.

    Note: It will take from 8 to 10 minutes for the virtual machine to complete the provisioning process.

  14. After creating the second virtual machine, you will create an endpoint in the port 80 in the Virtual Machine you created first. To do this, click on the first Virtual Machine Name (iisvm1) to go to the Dashboard page and then click Endpoints. Click Add Endpoint on the bottom pane.

    adding-a-new-endpoint-dashboard

    Selecting Add Endpoint in the dashboard

  15. Make sure that Add Endpoint option is selected and then click the right arrow button to continue.

    adding-a-new-endpoint

    Adding a new Endpoint

  16. In the Specify endpoint details page, set the Name to webport, the Protocol to TCP and the Public Port and Private Port to 80. Click the button to create the endpoint. Wait until the Endpoint is created before continue to the following steps.

    new-endpoint-details

    New Endpoint Details

    Note: It will take some minutes to create a new endpoint.

  17. Now, create a new Endpoint in the second Virtual Machine in order to enable Load Balancing between both Virtual Machines. To do this, click Virtual Machines and then select the second Virtual Machine you created. Then, click Endpoints.

  18. Click Add Endpoint, select Load Balance Traffic On An Existing Endpoint option. Select the endpoint you created for the first Virtual Machine from the drop down list and then click the right arrow to continue.

    load-balance-traffic-an-an-existing-endpoint

    Load Balance Traffic On An Existing Endpoint

  19. In the New Endpoint Details page, set the Name to webport and the Private Port to 80. Click the button to create the endpoint.

    Note: It will take some minutes to create a new endpoint.

  20. In the Virtual Machines section, click on the first Virtual Machine Name (iisvm1) and then click Endpoints.

  21. Select the webport endpoint you have created. Make sure the Load Balancer column value is Yes.

    creating-load-balancing-endpoint-1

    Verification: enabling IIS Load Balancing

  22. Click the Edit Endpoint button in the bottom bar to enter the endpoint details and verify the load balancing is enabled. Repeat this step in the second Virtual Machine.

    creating-load-balancing-endpoint-2

    Verification: enabling IIS Load Balancing, details

Task 2 - Configuring IIS Virtual Machines

In this task, you will configure the IIS Virtual Machines by adding the necessary roles to deploy the MVC application.

  1. In the Portal, click Virtual Machines on the left menu.

  2. You will see a list with your existing Virtual Machines. Select the first one you created in Task 1 and click the Connect button in the bottom bar. If you used the proposed name, this Virtual Machine should be named iisvm1.

  3. You will be asked to download the remote desktop settings file. Click Open and log on using the credentials you defined when creating the Virtual Machine.

  4. In the Azure Virtual Machine, open Server Manager from Start | Administrative Tools.

  5. In the Server Manager window, select Roles node.

    server-manager

    Server Manager

  6. Click Add Roles link.

    adding-server-roles

    Adding Server Roles

  7. The Add Roles Wizard will appear.

  8. In the Before You Begin page, read the content and click Next.

  9. In the 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.

    add-roles-wizard2

    Add Roles Wizard

  10. The Application Server page provides a brief introduction about Application Server's capabilities. Click Next when you complete reading it.

  11. In the Select Role Services page for Application Server, select Web Server (IIS)Support and make sure .NET Framework 3.5.1 is selected. It will prompt a dialog warning about missing Required Role Services. Click Add Required Role Services to install them and then click Next

    add-roles-wizard3

    Add Roles Wizard

  12. The Web Server (IIS) page provides a brief introduction about Web Server (IIS) capabilities. Click Next when you complete reading.

  13. The Select Role Services page for Web Server (IIS) page will display the selected role services that will be installed. Click Next.

    add-roles-wizard4

    Add Roles Wizard

  14. In the Confirm Installation Selections page, make sure the displayed services that will be installed are the ones you have selected (.NET Framework 3.5.1 support and IIS), and then click Install.

    add-roles-wizard

    Add Roles Wizard

    Note: It will take some minutes to complete the installation.

  15. Close the Remote Desktop Connection.

    Repeat this task on the second Virtual Machine to install IIS, starting from step 4. If you used the proposed name, the second Virtual Machine should be named iisvm2.

Published at DZone with permission of Bruno Terkaly, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)