How to Upload a Virtual Machine to the Cloud for Microsoft Azure
Recently, I worked with Microsoft Azure to provide better solutions using Visual Stuido 2015 and Team Foundation Server 2015 and Visual Studio Online, here...I will just share my experience about that through a new series which introduce different and random features for Microsoft Azure
How to Upload a Virtual Machine to the Cloud in Microsoft Azure
[youtube=http://youtu.be/1A6b2Gq4j58]
Introduction
Step 1: Check-out the Container created in the Storage
Step 2: Install Azure-PowerShell
Step 3: Upload .Vhd File
Step 4: Check-out uploaded .Vhd File in the Container
Step 5: Create a Disk from a VHD
Step 6: Create a New Virtual Machine using From Gallery Method
Step 7: Connect to Windows Azure Virtual Machine
Conclusion
Introduction
This post will describe how to create and manage a virtual machine (VM) in Microsoft Azure. You will see step by step on how to upload your local virtual machine to Microsoft Azure Cloud and create a fully functional virtual machine on the cloud.
Step 1: Check-out the Container created in the Storage
In order to upload the Virtual Machine you need to have a container inside the storage. If you don’t have that already you would need to create one.
1. From the navigation pane, click on Storage.
2. Click on the storage created <vmsmra> inside which you have created container.
3. Click on the container created for your uploaded VHDs <uploadedvhds>.
http://mohamedradwan.files.wordpress.com/2016/02/1-container-created-in-the-storage-to-upload-virtual-machine_thumb.jpg?w=680
Step 2: Install Azure-Powershell
You would need a machine to upload .vhd file. In this case we will use Azure PowerShell. If you don’t have Azure PowerShell, you will need to download it.
1. Use the direct link to download .msi file for Azure-PowerShell.
https://go.microsoft.com/fwlink/?LinkID=279888&clcid=0x409
Note: You can also download it from GitHub.
https://github.com/Azure/azure-powershell
2. Click on the downloaded .msi file to install Azure-PowerShell.
3. Click on the License Agreement check box.
4. Click on Install.
http://mohamedradwan.files.wordpress.com/2016/02/2-install-azure-powershell-machine-to-upload-vhd-file_thumb.jpg?w=680
Step 3: Upload .Vhd File
When you upload .vhd file, you can place it anywhere within your blob storage.
1. Run Microsoft Azure PowerShell.
2. PowerShell console will open up. Type ‘Add-AzureAccount’ and press enter.
Note: Type ‘help azure’ to get all the cmdlets.
3. You will be prompted to sign in to your Microsoft account. Type your email address and password then press enter.
http://mohamedradwan.files.wordpress.com/2016/02/3-upload-vhd-file-by-running-microsoft-azure-powershell_thumb.jpg?w=680
4. Type a command with the following syntax and press enter:
Add-AzureVhd [ -Destination ] <url> [ -LocalFilePath ] <FileInfo>
Where:
· Add-AzureVhd cmdlet allows you to upload on-premises virtual hard disks (in .vhd file format) to a blob storage account as fixed virtual hard disks.
· -Destination <url> specifies the URL of a blob in Blob Storage. The parameter supports SAS URL, although patching scenarios destination cannot be an SAS URL.
· -LocalFilePath <FileInfo> specifies the path to the local .vhd file.
In our case we will type:
Add-AzureVhd –Destination https://vmsmra.blob.core.windows.net/uploadedvhds/vsalm.vhd -LocalFilePath “E:\VisualStudio2013 Update3 ALM\WMIv2\Virtual Hard Disks\2012R2Eval.vhd”
http://mohamedradwan.files.wordpress.com/2016/02/4-upload-vhd-file-by-running-microsoft-azure-powershell-2_thumb.jpg?w=680
5. It would calculate MD5 Hash, detect empty blocksthen upload vhd file. The total elapsed time can be around 1.5 hours, of course it depends on your internet speed and the size of the VHD.
http://mohamedradwan.files.wordpress.com/2016/02/5-upload-vhd-file-by-running-microsoft-azure-powershell-3_thumb.jpg?w=680
Step 4: Check-out uploaded .Vhd File in the Container
The uploaded **.vhd file **would be saved in the designated container inside the storage.
1. From the navigation pane, click on Storage.
2. Click on the storage <vmsmra>.
3. Click on the container <uploadedvhds> to view uploaded VHDs.
4. You can now view your uploaded vhd <vsalm.vhd>.
http://mohamedradwan.files.wordpress.com/2016/02/6-uploaded-vhd-in-the-container_thumb.jpg?w=680
Step 5: Create a Disk from a VHD
After you transfer .vhd file from your local machine to the container in Microsoft Azure, you must create a disk.
1. From the Azure classic portal, under All Items, click on Virtual Machines.
2. Under Virtual Machines, click on Disks.
3. From the command bar at the bottom of the Portal screen, click on Create.
4. A pop up window <Create a disk from a VHD> will be displayed. In Name field, type a unique disk name. In this case we have named it VSALMDisk.
5. In VHD URL field, click on the folder icon.
http://mohamedradwan.files.wordpress.com/2016/02/7-create-a-disk-from-vhd-from-azure-classic-portal_thumb.jpg?w=680
6. Browse to the container location. Click on vmsmra.
7. From the containers within vmsmra, click on uploadedvhds.
8. Click on uploaded vhd <vsalm.vhd>.
9. Click on Open.
http://mohamedradwan.files.wordpress.com/2016/02/8-create-a-disk-from-vhd-from-azure-classic-portal-2_thumb.jpg
10. Click on The VHD contains an operating system check box.
Note: In Operating System Family, select your OS. In this case we will select Windows.
11. Click on check mark.
http://mohamedradwan.files.wordpress.com/2016/02/9-create-a-disk-from-vhd-from-azure-classic-portal-3_thumb.jpg
12. After few minutes, it will show up the notification that the disk has been successfully created.
13. You can then see the disk created <VSALMDisk> in the list of disks.
http://mohamedradwan.files.wordpress.com/2016/02/10-create-a-disk-from-vhd-from-azure-classic-portal-4_thumb.jpg?w=680
Step 6: Create a New Virtual Machine using From Gallery Method
The Microsoft Azure Portal provides two basic methods to create a new virtual machine: Quick Create and From Gallery. In this case we will use From Gallery Method.
1. Under Virtual Machines, click on Instances.
2. From the command bar at the bottom of the Portal screen, click on New.
3. A pop up window will open up. Under Virtual Machine options, click on From Gallery.
http://mohamedradwan.files.wordpress.com/2016/02/11-create-virtual-machine-from-microsoft-azure-portal_thumb.jpg?w=680
4. On the Choose an Image page, click on My Disks.
5. Click on the disk you created <VSALMDisk>.
6. Click on proceed arrow icon.
http://mohamedradwan.files.wordpress.com/2016/02/12-create-virtual-machine-from-microsoft-azure-portal-and-choose-an-image_thumb.jpg
7. On the first Virtual Machine Configuration page, specify the name for the virtual machine in Virtual Machine Name field. In this case we have used VSALM-mra.
Note: In Tier field, make sure Standard is selected.
8. Under the Size field, select D2 (2 cores, 7 GB memory).
9. Click on proceed arrow icon.
http://mohamedradwan.files.wordpress.com/2016/02/13-create-virtual-machine-from-microsoft-azure-portal-and-set-virtual-machine-configuration_thumb.jpg
10. On the second Virtual Machine Configuration page, set the following virtual machine attributes as shown in figure.
· Cloud Service – This is a cloud service container for virtual machines that you create. You can create a new cloud service container for a single virtual machine or place multiple virtual machines in the same cloud service for load balancing.
· Cloud Service DNS Name – This is the global DNS name that is used to contact the virtual machine.
· Region/Affinity Group/Virtual Network - This is the Region where you want the virtual machine resources to be physically deployed. The Affinity Group attribute allows Azure to keep all services in a group physically close. The Virtual Network attribute allows you to define the network to connect to the virtual machine.
· Availability Set – This is used to define a group of virtual machines that are deployed across fault and update domains.
· Endpoints – These are the communication ports through which the virtual machine can be contacted.
11. Click on proceed arrow icon.
http://mohamedradwan.files.wordpress.com/2016/02/14-create-virtual-machine-from-microsoft-azure-portal-and-set-virtual-machine-configuration-2_thumb.jpg?w=680
12. On the third Virtual Machine Configuration page, set the following virtual machine attributes as shown in figure.
· VM Agent – The VM Agent installs extensions that enhance the interaction with the virtual machine. This option cannot be disabled when installing a Linux image. For Windows data disks and Linux images and disks, a version of the VM agent that supports extensions must already be installed in the operating system.
· Configuration Extensions – These are extensions that enhance the management of the virtual machine, including the execution of custom scripts.
· Security Extensions - These are extensions that enhance the security of the virtual machine, such as antivirus support.
13. Click on check mark.
http://mohamedradwan.files.wordpress.com/2016/02/15-create-virtual-machine-from-microsoft-azure-portal-and-set-virtual-machine-configuration_thumb.jpg
14. You can see near the command bar at the bottom left of the Portal screen, the Virtual Machinebeing created. It will first create the virtual machine, provision the virtual machine and then install extensions in the virtual machine.
15. After few minutes, it will show up the notification that the virtual machine has been successfully started.
16. You can then see the new virtual machine created <VSALM-mra> in the list of VM Instances.
http://mohamedradwan.files.wordpress.com/2016/02/16-create-virtual-machine-from-microsoft-azure-portal-2_thumb.jpg?w=680
Step 7: Connect to Windows Azure Virtual Machine
In the Azure classic portal, you use the Connect button to start a Remote Desktop session and log on to a Windows VM.
1. From the navigation pane, click on Virtual Machines.
2. Under Virtual Machines, click on the name of the virtual machine<VSALM-mra>.
3. From the command bar at the bottom of the Portal screen, click on Connect.
4. Click on OK. It creates and downloads a Remote Desktop Protocol file (.rdp file).
http://mohamedradwan.files.wordpress.com/2016/02/17-connect-to-windows-azure-virtual-machine-by-downloading-rdp-file_thumb.jpg?w=680
5. Open downloaded .rdp file from your local machine.
6. In the Windows Security window, type the credentials for an account on the virtual machine.
7. Click on OK.
http://mohamedradwan.files.wordpress.com/2016/02/18-connect-to-windows-azure-virtual-machine-by-downloading-rdp-file-2_thumb.jpg?w=680
8. You can now access the machine of Brian Keller that you uploaded in Windows Azure.
http://mohamedradwan.files.wordpress.com/2016/02/19-connect-to-brian-keller-windows-azure-virtual-machine_thumb.jpg?w=680
Conclusion
The Microsoft Azure Portal provides multiple, simple methods to create and manage virtual machines in the Microsoft public cloud. Using the Quick Create method, you can quickly create new virtual machines and go back later to set more configuration options. Using the From Gallery method, you can fully customize the virtual machine configuration before it is deployed into the physical region as a standalone or load balanced service. Microsoft Azure virtual machines scale in processor, memory, and storage, allowing you to create virtual machines with a large number of cores and memory, and data disks up to 1 TB in size. As an added benefit, you can easily move a virtual machine created in Microsoft Azure to Hyper-V and back since both use the same virtualized hardware and VHD format. This allows you to quickly reconfigure services on premise or redeploy to the public cloud to adjust to changing business conditions.