Building a UAT environment in Microsoft Azure (Part 2)

As a follow-up to Part 1 of Creating a UAT Environment in Microsoft Azure, I will now walk through why a Microsoft Azure Cloud Service is important and how to 'finally' provision a Virtual Machine.

Cloud Service

The Cloud Service is an interesting component of the Microsoft Azure Service model.

Microsoft Azure Virtual Machines are built on the same service model that web and worker roles use, with some additional enhancements supporting persistent storage and a single instance per role.

The Cloud Service acts as a container of virtual machines and allows you to access your virtual machines via a URL address, setups a way for your virtual machines to communicate with each other, enable load-balancing and maintain high-availability (if required).

When a Cloud Service is acting as a container for a virtual machine/s you are not charged for that Cloud Service. For the UAT Environment, I created a Cloud Service which was used to group together the 3 virtual machines for the system running in the UAT environment.

To create a Cloud Service in Microsoft Azure:

  1. Select Cloud Services in the Microsoft Azure Management Portal and the + New located in the bottom left hand corner to bring up a menu of the Cloud Services available to create. Select Computer, Cloud Service and Custom Create

  2. Enter a URL Name for the Cloud Service (i.e. clipsal.cloudapp.net) to create an accessible endpoint for your virtual machines

  3. Select the Affinity Group you previously created

  4. Click the Checkmark to provision your Cloud Service

The Deploy a cloud service package checkbox is used for web and worker roles and is not required when creating a Cloud Service for virtual machines.

Virtual Machines

Now we are getting somewhere!

We have an Affinity Group, a Virtual network, a Cloud Service and have provisioned a Storage Account for our BLOBS. The next step is to provision our virtual machines.

To kick this off we need to decide what size virtual machine is required. The options are listed in t-shirt sizes (XS, S, M, L or XL) with each size providing access to a virtual machine with a different number of virtual cores and RAM as well as different number of VHD's that can be attached to a virtual machine.

This number of VHD's is important as it impacts the IOPS (i.e. that is the throughput in Mbps) available to the server.

Each virtual machine provisioned is stored as a BLOB within the VHD Container of the Storage Account. Each individual VHD (with a long name such as storage account name-server-2014-01-18.vhd) contains your virtual machine operating system disk and depending upon the image template you selected from the Gallery, the software as well (i.e. SQL Server).

When you remote into a virtual machine you will see a C drive and a D drive. The C drive is persistent storage from your VHD file, the D drive is volatile storage which does not use a Windows Azure Storage Account and is the physical disk within the rack your virtual machine is running off.

Microsoft provide access to the D drive without an additional charge to act as a temporary staging area. Files that need persistent storage (i.e. a MDF or LDF file from SQL Server)should not be stored on the D drive. Windows Azure by default will use the D drive for the operating systems paging file.

For the UAT Environment, 1 x Medium (2 x 1.6 GHz CPU, 3.5GB RAM) to 1 x Large (4 x 1.6 GHz CPU, 7GB RAM) virtual machines were selected for the Application and Agent Servers running Windows Server 2008 R2 SP1. A Medium (2 x 1.6 GHz CPU, 3.5GB RAM) was selected for the SQL Server running SQL Server 2008 R2 SP2 Standard.

With the total size of the two client databases exceeding 80GB and the databases expected to exponentially grow with the upcoming introduction of the next release, an additional 160GB of storage was provisioned and attached as the F drive to house the MDF and LDF database files. All virtual machines were provisioned in the Clients Cloud Service using the clients Affinity Group.

To create a virtual machine in Windows Azure:

  1. Select Virtual Machines Services in the Windows Azure Management Portal and the + New located in the bottom left hand corner to bring up a menu of the virtual machines you can create. Select Computer, Virtual Machine and From Gallery

  2. Select the type of virtual machine you require (i.e. Windows Server 2012 R2 Datacentre). Please note Microsoft and another vendor images are also available. You also have the option of uploading you own VHD or image and making it available in the Gallery (this will be described in a future post)

  3. Enter a Name for the virtual machine

  4. Select the Size of the virtual machine

  5. Enter a user name and password for the administrator account. Administrator is a reserved account within Windows Azure therefore requiring you to enter an alternative name for the administrator account

  6. Select the Cloud Service and Affinity Group you previously created as well as the Virtual Network you plan to use

  7. Select the Storage Account you previously created

  8. Update the end-points for accessing the virtual machine via Remote Desktop and PowerShell and any other end-points you require (including your web-services) via the Windows Azure Management Portal. Please note that the Public Ports for virtual machines within the same Cloud Service cannot be the same

  9. Click the Checkmark to provision your virtual machine. Provisioning can take up to 10 minutes to complete depending upon the image you selected from the Galley

Storage (Part 2)

As mentioned earlier, I provisioned additional storage for the large databases used by the Client. To do this, I selected the SQL Server virtual machine and clicked Attach and selected Attach empty disk option at the bottom of the Windows Azure Management Portal.

As this virtual machine is already linked to the Clients Storage Account, all that was required was the GB size for the disk. I left the Host Caching preferences as None. Once provisioned, this disk is available to the SQL Server and can be formatted and bought online via the Windows Server Management console. You can see this VHD file (with the same name as your Server) in Windows Azure Management Portal if you select Storage, click your Storage Account and select Containers.

Please note at this point, the resizing of VHD files via the Windows Azure Management Portal is not supported. This is planned to change with the introduction of the VHDx file format.