Hi, I have been trying to follow the steps to enable me to upload a Microsoft VHD Image to azure and use it to create a VM however, I have not been able to.
So
$diskconfig = New-AzDiskConfig -SkuName 'Standard_LRS' -OsType 'Windows' -UploadSizeInBytes $vhdSizeBytes -Location 'West US' -CreateOption 'Upload' (This also worked)
New-AzDisk -ResourceGroupName 'myResourceGroup' -DiskName 'myDiskName' -Disk $diskconfig - (This did not work).
I get the error:
New-AzDisk : The upload size in bytes 112074530816 - 512 bytes for the VHD footer (112074530304 in this case) must be
a multiple of MiB.
When I run the below command to resize the Vhd to a multiple of 1024MB and a size of 127GB (136365211648 in bytes)
Resize-VHD -Path C:UsersPublicDocumentsHyper-VVirtual hard disksFinandOpsV10.vhd -SizeBytes 136365211648
I get the error below
Resize-VHD : Failed to resize the virtual disk.
The system failed to resize 'C:UsersPublicDocumentsHyper-VVirtualHardDisksFinandOpsV10.vhd'.
The requested operation cannot be performed as resize operation to new size that is smaller than or equal to the
current size is supported only on virtual hard disks that are of VHDX format.
Failed to resize the virtual disk.
The system failed to resize 'C:UsersPublicDocumentsHyper-VVirtualHardDisksFinandOpsV10.vhd': One or more
arguments are invalid (0x80070057).
The requested operation cannot be performed as resize operation to new size that is smaller than or equal to the
current size is supported only on virtual hard disks that are of VHDX format.
At line:1 char:1
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@gyne Thanks for the feedback! We are currently investigating and will get back on this.
Thanks @VikasPullagura-MSFT
Just an update. I noticed that when I run this command
_get-vm "D365" | select -expand HardDrives | get-vhd_
as shown in the image, I get a different file size which is exactly a multiple of 1024 but when I run another command as shown in the image
_(Get-Item "C:\Users\Public\Documents\Hyper-V\Virtual hard disks\FinandOps10.0.5.vhd").length_
I get a different size which is not a multiple of 1024
NB: the FinandOps10.0.5.vhd is the vhd disk attached to the D365 VM in the first command

@gyne
Thank you for your question! Since this channel is for driving improvements towards MS Docs, and your issue need deep investigation and live troubleshooting.
I would request you to open a support ticket so that this issue can be handled by a support engineer.
If you don't have the ability to open a technical support ticket, you can email me at [email protected] and provide me with your SubscriptionID and link to this thread. I can then enable your subscription for one time free support.
I came across this issue with the VHD for 365FO as well. The thing is that MS provides this VHD with Dynamic Type and Azure requires FixSize'd VHD. You can convert the type using Hyper-V Manager or Powershell
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/prepare-for-upload-vhd-image
DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V
Convert-VHD -Path filepathtoyourDynamicVHDorVHDX.VHDX file -DestinationPath destinationfileofnewVHD.VHD -VHDType Fixed
Get-VHD -Path 'PathtoYourFixedSized.VHD' | Select-Object *
Resize-VHD -Path 'PathtoYourFixedSized.VHD' -SizeBytes '274877906944' #for a 256 GiB Disk
Get-VHD -Path 'PathtoYourFixedSized.VHD' | Select-Object *