With the goal of using and taking advantage of cloud services, we wanted to do what Microsoft Azure folks call a ‘lift and shift’ model for migration for a proof of concept application compatibility. In that context we have picked four local virtual machines instances and their application configuration, with the goal of re-configuring them within Azure’s cloud infrastructure.
We have picked three “Medium” sized instances (dual core, 3.5 GB of RAM, 128 GB HD), and one “Small (A1)” sized (single core, 1.75 GB of RAM, 128 GB HD). We have decided on what the names would, the private IP addresses, and connection configuration amongst the machines.
Since this is a simple deployment with “MVP” (Minimum Viable Product) in mind, we chose not to have a DNS server, rather simply entered each machines’ IP private addresses in each machine’s “hosts” file so that the names would resolve.
Not going to discuss and screen capture the Azure portal settings, but at this time of writing, there are two Azure portals(?), one is the legacy, and the other is the modern with progressive disclosure portal. The legacy portal is definitely more complete, but I ran into instances where I could not take one action, but I could on the other and vices versa. Have to say that Azure team is hard work and I am sure they will get their ducks in a row pretty soon, and things will run smoother.
Basic steps are as follows, and it essential to follow a plan so that it is repeatable by others in your company, take good notes and observe the outcomes on the portal.
- Create a storage account within the Azure portal (I used the legacy portal)
- Create a virtual network (this picture shows VMs already created.
- Upload the VHD created into Azure. I used Azure Powershell SDK for that. There are also other open source tools for NodeJS which I have been dabbling with, but Powershell seems more natural and complete for a Windows platform. Perhaps that would change in a few years, but I digress. Oh, before you do that, you need to import your subscription profile and set the current storage account. The instructions to do that are here. Then you’re ready.
The command I used is as follows:
1 Add-AzureVhd –Destination “https://yourstoragename.blob.core.windows.net/vhds/yourVhdFileName.vhd –LocalFilePath “<path_to_local_file>” - Depending on big the VHD file is, it may be a while, and this is the time to take dogs for a walk or have lunch/dinner (what have you), since it first creates MD5 hash and uploads the image to your cloud storage.
- After a successful upload, you can attach this disk to your VHDs, once they are available.
- To create virtual machine on Azure, I prefer to use Azure Powershell SDK again since I want to have control over the names, passwords, IP address and virtual network configuration. Here is my sample script which defines the variables on the top and in a ‘piped’ fashion creates the VMs on Azure. 1 ## Basic Configuration
2 $vmName = "testVM"
3 $svcName = "testVM"
4 $instanceSize = "Medium"
5 $location = "Central US"
6 $labelString = "test web and sql server"
7
8 ## Login credentials
9 $un = "testadmin"
10 $pwd = "password"
11
12 ## Network Variables
13 $vnet = "test-vnet"
14 $sub = "test-subnet"
15 $ip = "10.0.4.4"
16
17 ## image name
18 $image = (Get-AzureVMImage | where-object { $_.Label -like "Windows Server 2012 R2*" -and $_.PublishedDate -eq "12/11/2014 2:00:00 AM"})
19
20 New-AzureVMConfig -Name $vmName -InstanceSize $instanceSize -Image $image.ImageName -Label $labelString |
21 Add-AzureProvisioningConfig -Windows -AdminUserName $un -Password $pwd |
22 Set-AzureSubnet -SubnetNames $sub |
23 Set-AzureStaticVNetIP $ip |
24 New-AzureVM -ServiceName $svcName -Location $location -VNetName $vnet
Created three similar scripts for each VM instance and ran it via the Azure SDK. After a few minutes, your private infrastructure is up and running. Make sure you patch your servers and install your applications.
In order to attach the existing VHD, I recommend using the new portal, since the old one won’t let me choose the container and such, the new portal is the way to go. Below screen capture shows the “Choose a disk” and make sure pick “OK” at the end to persist your changes.
That is about it. You can attach and detach your VHD file across VM instances you created in a few minutes, or you can allow network sharing within the instances you have created and shuffle source code and installation files that way.
In summary, we are seriously considering moving our existing infrastructure to the cloud, either Azure or perhaps another vendor, but doing this takes time, working with our clients, looking at compliance and security aspects. In cloud terms, what we are utilizing is “Infrastructure As A Service” (IaaS), next one is “Platform As A Serivce” (PaaS), and the last step is “Software As A Service” (SaaS), which will really allow us to focus on our code versus maintaining our servers and infrastructure. Yet there is a balance.
A good starting point with Azure, “Fundamentals of Azure” can be downloaded from here.
Happy Cloud Computing!