Here's example steps for uploading a Windows VHD to Azure. I initially built mine using this Packer script,
then used PowerShell to convert it - Convert-VHD -VHDType Fixed -Path <source.vhdx> -DestinationPath WindowsServer2016Insider.vhd
, and last the Azure CLI 2.0 to upload it.
az login
# If you need to use a specific subscription, then
# az account set --subscription <subscription name>
# Resource group to contain all resources
export rg=<resourcegroupname>
# Storage account name
export storageacct=<storageacctname>
# VHD filename
export vhdfilename=WindowsServer2016Insider.vhd
# Azure disk name
export diskname=vm1disk1
# VM name
export vmname=vm1
az group create --name $rg --location westus2
az storage account create --resource-group $rg --location westus2 --name $storageacct --kind Storage --sku Standard_LRS
az storage container create --account-name $storageacct --name mydisks
az storage account keys list --resource-group $rg --account-name $storageacct
# Get key from that step
az storage blob upload --account-name $storageacct --account-key "<key>" --container-name mydisks --type page --file /mnt/d/VMs/.../WindowsServer2016Insider.vhd --name WindowsServer2016Insider.vhd
az storage blob url --account-name $storageacct --account-key "<key>" --container-name mydisks --name $vhdfilename
az disk create --resource-group $rg --name $vm1disk1 --source "https://$storageacctname.blob.core.windows.net/mydisks/WindowsServer2016Insider.vhd"
az vm create --resource-group $rg --location westus2 --name $vmname --os-type windows --attach-os-disk $diskname --size standard_d2_v3
# Take note of public IP returned
# Now connect with remote desktop
mstsc.exe /v:<ip> &