Azure download vhd of managed disk

536 Views Asked by At

I have a VM on Azure where I want to download the vhd file from the OS-disk. The VM has a managed disk, so I can't access the blob storage of the file disk.

I followed following guide from MS: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/download-vhd?tabs=azure-portal#generate-download-url

Already tried multiple things:

  1. When going to the latest step of the guide and surfing to the url generated I get following error: NoAuthenticationInformation Server failed to authenticate the request. Please refer to the information in the www-authenticate header. RequestId:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxTime:2023-07-11T11:45:34.6520445Z

My account has the role Data Operator for Managed Disks and Storage Blob Data Owner assigned but I still get this message.

  1. I also tried downloading the disk file using Microsoft Azure Storage Explorer. However also an error is thrown there: AzCopy error message: failed to perform copy command due to error: Login Credentials missing. No SAS token or OAuth token is present and the resource is not public

-> as the blob storage is not visible I can't create a SAS token and I can't set the resource public

  1. With a script I tried to copy the disk to a blobstorage I created. However again ran in to the same error message as in step 1.

Anybody else tried this fairly easy thing? Any more ideas?

1

There are 1 best solutions below

2
On

Create virtual machine and attach managed disk in vm and then try to generalize the VM like below:

Connect with VM -> open file manager-> windows -> system 32 -> sysprep -> sysprep and generlize like below:

enter image description here

Once deallocated the VM, create snapshot to the vm disk:

enter image description here

Select the operating system disk for the VM and Disk Export change the default time to 36000 and click Generate URL.

enter image description here

In Access control (IAM) Assign Data Operator for Managed Disks role to the user like below:

enter image description here

Now when I try to export the disk it shows secure URL and download the VHD file:

enter image description here

VHD file is downloading successfully like below:

enter image description here