Blogs Banner
How to Upload a Virtual Machine to the Cloud for Microsoft Azure

How to Upload a Virtual Machine to the Cloud for Microsoft Azure

22nd Jan, 2017

Introduction

This post will describe how to create and manage a virtual machine (VM) in Microsoft Azure. You will see a step by step guide 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 do not have that already you will need to create one.

  1. From the navigation pane, click on Storage.
  2. Click on the storage created inside which you have created container.
  3. Click on the container created for your uploaded VHDs <uploadedvhds>.

Step 2: Install Azure-Powershell

You would need a machine to upload .vhd file, in this case, we will use Azure PowerShell. If you do not 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: 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.

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.
  4. Type a command with the following syntax and press enter:Add-AzureVhd [ -Destination ] [ -LocalFilePath ]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 specifies the URL of a blob in Blob Storage. The parameter supports SAS URL, although patching scenarios destination cannot be an SAS URL.· -LocalFilePath 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 ALMWMIv2Virtual Hard Disks2012R2Eval.vhd”
  5. It would calculate MD5 Hash, detect empty blocks then 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.

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>.

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 command bar at the bottom of the Portal screen, click on Create.
  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.

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. We will be using the 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. Note: In Tier field, make sure Standard is selected.
    9. Under the Size field, select D2 (2 cores, 7 GB memory).
    10. Click on the proceed arrow icon.
    11. On the second Virtual Machine Configuration page, set the following virtual machine attributes as shown in figure.
      1. 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.
      2. 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.

 

  • Click on proceed arrow icon.
  • 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.
  • Click on check mark.
  • You can see near the command bar at the bottom left of the Portal screen, the Virtual Machine being created. It will first create the virtual machine, provision the virtual machine and then install extensions in the virtual machine.
  • After a few minutes, it will show up the notification that the virtual machine has been successfully started.
  • You can then see the new virtual machine created in the list of VM Instances.

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.
  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.

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 deployment 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 & 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.