The powershell commands in the section 'Create a managed image from the uploaded VHD' don't seem to be correct for a VHD that has been uploaded straight into a managed disk.
Specifically:
-BlobUri $urlOfUploadedImageVhd `
The vhd in the managed disk doesn't have a URL.
How do i create an image from a generalized VHD uploaded directly into a managed disk?
Thanks
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks for the feedback! We are currently investigating and will update you shortly.
@andyturn31 You can use the managed disk ID instead. Please take a look at this doc and let me know if you have any questions.
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource#create-an-image-from-a-managed-disk-using-powershell
@andyturn31 Is there any update?
HI
Am i correct in thinking that you can't create an Image directly from an uploaded VHD? So you have to create a VM first and then reference $diskID = $vm.StorageProfile.OsDisk.ManagedDisk.Id when creating the image?
@andyturn31 Sorry it has taken me awhile to get back to this issue. If you follow the instructions here: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-upload-vhd-to-managed-disk-powershell for uploading straight to a manage disk, you should already have a variable called $disk for the managed disk. If that is the case, you can simply assign the ID to the $diskID variable by doing: $diskID = $disk.id and use https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource#create-an-image-from-a-managed-disk-using-powershell to create the image .
If you don't still have that variable available, you can Get the disk again and do the same variable assignment by doing:
$disk = Get-AzDisk -ResourceGroupName 'myResourceGroup' -DiskName 'myDiskName'
$diskId = $disk.Id
From there, you should be able to make an image from the uploaded managed disk using this section: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource#create-an-image-from-a-managed-disk-using-powershell
I'll try to get the article updated ASAP, but hopefully this will help in the meantime :)
Thanks @cynthn :)
@andyturn31 Hope that helped answer your question.
Thanks for bringing this to our attention. We will now close this issue. If there are further questions regarding this matter, please tag me in a comment. I will reopen it and we will gladly continue the discussion.
Most helpful comment
@andyturn31 Sorry it has taken me awhile to get back to this issue. If you follow the instructions here: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-upload-vhd-to-managed-disk-powershell for uploading straight to a manage disk, you should already have a variable called $disk for the managed disk. If that is the case, you can simply assign the ID to the $diskID variable by doing:
$diskID = $disk.idand use https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource#create-an-image-from-a-managed-disk-using-powershell to create the image .If you don't still have that variable available, you can
Getthe disk again and do the same variable assignment by doing:$disk = Get-AzDisk -ResourceGroupName 'myResourceGroup' -DiskName 'myDiskName'$diskId = $disk.IdFrom there, you should be able to make an image from the uploaded managed disk using this section: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource#create-an-image-from-a-managed-disk-using-powershell
I'll try to get the article updated ASAP, but hopefully this will help in the meantime :)