Javascript required
Skip to content Skip to sidebar Skip to footer

How Do I Upload a Picture for Virtual on Target

While enterprises tin can choose to use a prepared Azure Marketplace prototype, creating a custom VM image gives cloud administrators more than control.

Creating a custom image has many steps, but the benefits are worth the time and attempt if a company wants something tailored to its needs. For instance, when an admin plans to deploy several identical machines that have a lot of manual configuration, a custom image can reduce the potential risk of errors.

Admins can create images locally or in the cloud, depending on their needs. Additionally, they tin can use customized images with templating to chop-chop deploy infrastructure that shares the aforementioned base deployment image.

This guide will demonstrate how to create a custom prototype locally and walk through the steps to upload the paradigm into Microsoft Azure. So, we will deploy our customized virtual car image into the deject. In this instance, we'll build a Windows image, but you can follow the same process for Linux images.

Step 1. Create the Windows image

For this tutorial, I used Hyper-V on Windows 10 Pro to create a Windows VM image. Earlier you get started, exist aware of the following back up factors.

  • Only Linux and Windows images are supported for upload and utilize in Azure.
  • Only the starting time generation of VMs are supported.
  • Azure simply supports VHD files, not VMX.
  • Select "fixed size" rather than "dynamic" because dynamic expanding -- i.east., sparse provisioned -- disks are non supported.

Footstep 2. Use the Windows Sysprep tool

Once you create a Windows VM and configure it, use the Windows Sysprep tool to ensure all the required unique items on the disk VM are reset and randomized to avoid conflicting settings issues. Sysprep can be establish in \Windows\System32\sysprep.exe. Don't take a snapshot before doing this, as information technology will crusade issues with the Azure upload. If required, re-create the whole VM to another location.

Pace three. Catechumen to VHD format

Close down the VM and copy just the VHDX file to a convenient location, such equally the desktop.

To convert the file to the required Azure VHD format, use PowerShell and the Catechumen-VHD cmdlet. You can specify the options in the command line. However, running information technology equally is volition enable you to specify both the input VHDX file and the output VHD paradigm file for upload to Azure.

The deejay image that is created needs to be uploaded into Azure Blob storage. That way, when information technology's fourth dimension to make the new templated server, we can hands reference the VHD file. It is possible, and unremarkably desirable, to store several uploaded disks in 1 Hulk storage account.

Figure 1. The blob service within storage account.
Figure one. The blob service inside storage account.

Step 4. Create a container under the Blob storage account

If you don't have an Azure storage business relationship, create one in the Azure Portal. Make sure information technology is prepare in the same Azure region every bit the items you are using for this example.

Once the storage account is available, navigate to the Azure Storage blade and create a Blob storage business relationship. Create a container under the account. Information technology should look like to Figure 1.

Click the + container button to create a new container.

Step five. Upload the blob

Blob uploading can exist a challenge for those who are unfamiliar with it. One way is to upload via the GUI, merely this lacks a lot of functionality. The GUI is also decumbent to timeouts and lacks any existent status reporting. It is much easier and more efficient to utilise the Add-AzureRmVhd command in PowerShell. Install the PowerShell Azure modules if not yet installed.

This command has a number of benefits:

  • It creates a checksum prior to uploading to ensure integrity.
  • Information technology accommodates empty deejay infinite -- no uploading of unused data in the image.
  • It provides a progress bar.

Using the command is simple, as shown in the example below:

Add-AzureRmVhd -ResourceGroupName "TT_EXAMPLE" -Destination "https://ttexamplestorage.hulk.core.windows.internet/ttexample/win.vhd" -LocalFilePath 'C:\Users\Stuart\Desktop\TT.vhd'

It merely requires a couple of arguments, the resources group, the blob destination, where the file is to exist uploaded to and the local deejay. If you aren't sure what your destination is, this code volition give you the directory to utilise:

$container= Go-AzureRmStorageAccount –ResourceGroupName 'TT_EXAMPLE' –Name 'ttexamplestorage' | Get-AzureStorageContainer -Container $ContainerName

Employ the above code snippet and repeat "$container" at the PowerShell command line to provide the hulk details you need.

Step 6. Convert the uploaded VHD to a VM image

Once the upload is complete, the administrator needs to convert the uploaded VHD to a VM image. Open the Azure Portal and select the images icon. If you don't see it, use the Azure search box and blazon "images."

Figure 3. Use the Images icon to create a VM template.
Figure 3. Use the Images icon to create a VM template.

Click the Add push from the ribbon to create the image. On the new images page, click create paradigm in the center of the folio. It volition open a new dialog box. Fill in the commencement part with your subscription details.

Footstep 7. Add instance details and deploy

Adjacent, fill up in the instance details, such as the image name and region. Be sure to select the same region that you uploaded the prototype to. It'southward too important to set the correct image type -- Linux or Windows. Leave everything else every bit is. Yous can select HDD rather than SSD to save coin, depending on your toll needs. Ensure the VM generation is set to ane.

Utilise the scan button to select the uploaded disk from the storage BLOB. Click the Review and create push button to execute the job. This will also highlight whatever issues yous will see.

You can also incorporate Puppet, SaltStack and other configuration tools. But follow the install before packaging up the Windows server. Some tools will automatically search for the DNS entry -- "common salt" for SaltStack, for example -- on kicking, which makes it easier to connect and configure. In order to apply such infrastructure, it volition need to exist already set up and running within the Azure subnet.

Figure 4. A deployed copy of local VM.
Figure 4. A deployed copy of local VM.

After a short while, the custom image is created in Azure and y'all can easily deploy i or more VMs from the image.

blairtrum1984.blogspot.com

Source: https://www.techtarget.com/searchcloudcomputing/tutorial/Build-a-custom-VM-image-for-Azure-deployments