Closed koyasuda-msft closed 3 years ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @avirishuv.
Compute team, please help to look into it.
@avirishuv can you please take a look at this issue?
@avirishuv can you check this issue?
@avirishuv @axayjo Could you provide update?
Looking into this issue.
@koyasuda-msft Could you provide all data disks in the request body while creating the VM? Even if the data disk at lun=0 is coming from the custom image, it needs to be provided along with additional data disks during creation of VM. The createOption property in this case would be FromImage and managedDisk id would be null.
@avirishuv Thanks for your comment. If I comment out following line, this error was not happened.
$VirtualMachine = Add-AzVMDataDisk -VM $VirtualMachine -Name $dataDisk.Name -CreateOption Attach -ManagedDiskId $dataDisk.Id -Lun $DatadiskLun
In this case, The data disks contained in the image are successfully attached to LUN0. So, I decided that I didn't need to specify Lun 0.
And, I tried your comment.
>Could you provide all data disks in the request body while creating the VM? >Even if the data disk at lun=0 is coming from the custom image, it needs to be provided along with additional data disks during creation of VM. The createOption property in this case would be FromImage and managedDisk id would be null.
I add following option in the script.
$VirtualMachine = Add-AzVMDataDisk -VM $VirtualMachine -Name testdiskm -CreateOption FromImage -Lun 0
Created on VM success. Thanks for telling me the workaround.
@koyasuda-msft good to know that this is working for you now. Closing this issue, but feel free to reopen if you have any other questions related to this issue. Thanks.
Description
The error happened when we create VM from Custom image. It only happens when you attach another disk additionally.
It does not occur if you do not attach additional disks. also, It does not occur if the custom image does not include a data disc.
Steps to reproduce
Environment data
Module versions
Debug output
Error output