When creating Virtual Machines in Azure, it is supported to select the images from the Azure gallery or use a custom image which you uploaded.
In this article, we introduce the detailed steps to create an Azure Virtual machine using the uploaded .vhd file. You can follow the steps below to do that:
1. Prepare the VHD file
The VHDX format is not supported in Azure. You can convert the disk to VHD format using convert-vhd cmdlet or using Hyper-V manager. For more information about this, please refer to: https://support.microsoft.com/kb/2799257?wa=wsignin1.0
In this test, we used the Windows Server Technical Preview and download the VHD file (named aswin10.vhd) from the link below: http://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-technical-preview
2. Connect to Azure account
You can install the latest version of Azure PowerShell on your on-premise computer. For detailed information, please refer to the link below:
http://azure.microsoft.com/en-us/documentation/articles/install-configure-powershell/
After that, we can connect to your Azure account using the two method below:
(1) Through Microsoft Azure AD
Open Microsoft Azure PowerShell console and type the command below:
Add-AzureAccount
Then in the prompt windows, type your Azure account to logon.
Figure 1.
(2) Through the certificate
Please open Microsoft Azure PowerShell windows and type “Get-AzurePublishSettingsFile” to download the files.
Figure 2.
After you save the .publishsettings file, type “Import-AzurePublishSettings File xxx” (xxx is the path to the .publishsettings file) to import the file in PowerShell session.
Figure 3.
3. Connect to the Subscription
If you have only one subscription, it will select the subscription and you don’t need to set the default Azure Subscription. If you have multiple subscriptions, you can use Get-AzureSubscription command to list the available Azure subscriptions, then type “Select-AzureSubscription -SubscriptionName "xxx"“ to connect the subscription you want to connect.
In the test, we have only one subscription, so when we logon with our Azure account, the unique subscription is selected as the default subscription.
Figure 4.
4. Create and identify the Storage Account and Container
A storage account is necessary to upload a .vhd file to Azure. If you have no storage account in Azure, you can use New-AzureStorageAccount cmdlet or follow the steps in the management portal in the article below to create one:
http://azure.microsoft.com/en-us/documentation/articles/storage-create-storage-account/
If you have already created multiple storage accounts in your subscription, pleasetype“Get-AzureStorageAccount” to list all the storage accounts, then you can type “Set-AzureSubscription -SubscriptionName "xxx" -CurrentStorageAccount"xxx"“ to specify the current storage account for your subscription.
Figure 5.
Then type “Get-AzureStorageContainer “ to get the URL for the container used for storing the .vhd file in the Storage account and copy the URL.
Figure 6.
5. Upload the VHD
Please type “Add-azurevhd –localfilepath “xxx” –Destination “xxx” ” to upload your local .vhd file. (-localfilepath is the path the .vhd located, -Destination is the URL you obtained in the step above)
Figure 7.
After running the command above, please wait for the uploading process to be accomplished.
Figure 8.
After the process finished, when you check the storage in Azure management portal, the win10.vhd file is located in Container.
Figure 9.
6. Add the Image to custom Images
a.In the Azure Management Portal, Click Virtual Machine, then clickImages to view the images.
Figure 10.
b.ClickCreate to open the Create an image from a VHD dialog box, then type the specified information in the blanks.
Figure 11.
c.After completing the previous steps, the new image is listed when you choose theImages tab.
Figure 12.
Now you can follow the article below to create an Azure virtual machine using uploaded image:
How to Create a Custom Virtual Machine
http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-create-custom/
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.