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 for Microsoft Azure
How to Upload a Virtual Machine to the Cloud in Microsoft Azure
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.
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>.
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.
Note: You can also download it from GitHub.
2. Click on the downloaded .msi file to install Azure-PowerShell.
3. Click on the License Agreement check box.
4. Click on Install.
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.
4. Type a command with the following syntax and press enter:
Add-AzureVhd [ -Destination ] <url> [ -LocalFilePath ] <FileInfo>
· 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”
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.
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>.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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).
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.
8. You can now access the machine of Brian Keller that you uploaded in Windows Azure.
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.