Building a UAT environment in Microsoft Azure
I was recently asked by one our long standing clients, to provide options for the introduction of a new UAT environment. The criteria they specified included being available in 4 days, scalable depending upon their testing cycle and accessible to the Solentive engineering and support teams as well as their own support team. With this criteria in place we selected Microsoft Azure.
As a slight deviation, the options for provisioning IaaS services within Windows Azure include using the Microsoft Azure Management Portal or the Microsoft Azure PowerShell. To get started you will need a Microsoft Azure Account. If you have an MSDN Premium Account you are entitled to $110 worth of monthly credits with Microsoft Azure, allowing you to run a number of Azure services without being billed (great for prototying!). To see more details of the Microsoft Azure Benefits for MSDN subscribers checkout this link.
The UAT Environment
Building the UAT environment required four Microsoft Azure Services. In the first part of this post, I walk through the creation of an Affinity Group and setting up a Virtual Network as well as discuss the first steps required to provision a Storage Account to house the Virtual Hard Disks (VHD). In a subsequent post I will discuss the provisioning of a virtual machine and drill into why a Cloud Service is required.
The Microsoft Azure Management Portal makes it very easy to quickly provision a Virtual Network, Storage Accounts and Virtual Machines via the 'Quick Create' option. A drawback of this options is that you lose some configuration flexibility and are locked into a 'hard-to-manage' default naming conventions for each service. With this in mind, I approached the creation of the UAT environment by selecting to configure each service (where possible) in the following sequence.
Affinity Group
An Affinity Group allows you to physically group together your Microsoft Azure Services to optimise their performance.
This is achieved by setting all the services to a specific Affinity Group, enabling the Microsoft Azure Fabric Controller to provision and keep specific services together and close to one another. This means services in the same Affinity Group are located in the same data centre (i.e. South East Asia), the same individual Container within the data centre and potentially the same cluster and rack.
Without an Affinity Group your services would be distributed throughout the global Microsoft Azure network which obviously impacts latency and subsequently performance.
An Affinity Group is also a prerequisite for creating a Virtual Network. For the UAT Environment I created an Affinity Group by selecting Settings (from the bottom left hand corner of the Microsoft Azure Management Portal) and then Affinity Groups at the top of the page. On the Affinity Groups page select Add and then enter the name, description and select the region you would like the Affinity Group to reside. For the UAT Environment we selected South East Asia (located in Singapore).
Virtual Network
Creating a Virtual Network, allows you to setup a range of DHCP IP address using the CIDR standards. Without a Virtual Network, Microsoft Azure allocates your Virtual Machine an internal IP Address from a predefined range and utilises the Microsoft Azure DNS Server for IP address routing.
By creating your own Virtual Network you are able to specify your a range of persistent internal IP address and optionally use your own DNS server. For the UAT environment I created a Virtual Network using the 10.x.x.x/24 range allowing up to 254 IP addresses and selected the Microsoft Azure DNS Server as my default DNS Server.
To create a Virtual Network in Windows Azure
Select Networks in the Microsoft Azure Management Portal and the + New located in the bottom left hand corner to bring up a menu of the Network Services, select Virtual Network and Custom Create.
Enter a name for your Virtual Network and select your recently created
Click the Next Arrow to select a DNS Server. This is optional and by not specifying a DNS server, you will automatically use the Microsoft Azure DNS Server
The final screen is where it gets fun! This screen allows you to specify your Virtual Network Address Space. For the UAT Environment (consisting of a small number of Virtual Machines) I implemented a standard configuration with a primary address space using 10.x.x.x/16 with 2 subnets called FrontSubNet (10.x.y.x/24) and BackSubNet (10.x.z.x/24)
Click the Checkmark icon to create your Virtual Network.
Storage (Part 1)
At this point, many people jump straight into provisioning their virtual machines. Before doing this, I prefer to provision a Storage Account.
Storage in Microsoft Azure is more interesting than you would initially think. Storage Accounts are used to group together Containers with an individual Container holding multiple Binary Large Object Storage (BLOBS). BlOBS store multiple types of data including VHD's used for the operating system disk in your virtual machine as well as any VHDs (up to 1 Terabyte) you plan to attach to your Virtual Machine as an additional drive.
To provide additional flexibility (and to not have a crazy long winded name that Microsoft Azure creates if you provision a Storage Account at the same time you create a Virtual Machine) I created a Locally Redundant Storage Account to group together all the Containers to be used in the UAT environment.
As this was a UAT environment only, Locally Redundant storage replication was selected over Geo Redundant storage replication. The Storage Account was set to the previously created Affinity Group.
Select Storage in the Microsoft Azure Management Portal and the + New located in the bottom left hand corner to bring up a menu of the Data Services you can create. Select Storage and Quick Create
Enter a URL Name for the Storage Account (i.e. clientname.core.windows.net) to create an accessible endpoint for the Virtual Machines to locate the storage or to access the BLOB via the Storage API
Select the Affinity Group you previously created and the storage replication you would like to use. Locally Redundant Storage is cheaper than Geo Redundant Storage
Click the Create Storage Account Checkmark to provision your Storage. At this point your Storage Account will not have any Containers (these come later)
With the Storage Account created, we can now move onto the main reason we are here - provisioning the Cloud Service and Virtual Machines (which I will take you through in part 2 of Building a UAT environment in Microsoft Azure in Windows Azure)
As a slight deviation, there are a range of 3rd party tools known as Storage Explorers to enumerate and transfer data from BLOBS within the Containers of your Storage Account. A slightly outdated list is available here. When you create a Storage Account, Microsoft Azure generates two 512-bit storage keys used for authentication when accessing the storage account. These keys will be required when using a 3rd party Storage Explorer tool.