azureazure-stack

How to download Azure VM Image(.vhd)?


I am trying to bring Cisco Cloud APIC image on Azure Stack Hub, but have no idea how to download its VM image from Azure. Can someone provide a complete roadmap of doing the same?


Solution

  • I did try below optimal things to copy vm images from azure -> Azure Stack Hub (ASH).

    1. On azure end:: Create a managed disk from the vm image. Generate a disk export with Read access privileges. You get SAS url token.
    2. On ASH end :: Create a storage account, then a container within that storage account.
    3. Now, we create page blob (only page blobs supported for vhd formats) on ASH container from the sas url using cli az storage blob rewrite --container-name --name <azure-image>.vhd --source-uri <sas-token-from-azure-disk> -c containername --account-name mystorageaccount --account-key <account-key>
    4. Once, copy is completed. You have the azure image in vhd format as a blob & you can create image from this vhd using portal or via cli command az image create -n ash-vhd-image --source <ash-vhd-url> -g <ash-rg-name>
    5. Don't forget to delete storage accounts on ASH, cancelling & deleting managed disks on Azure. It's completely optional but good not to have post image creation.

    Above way you can avoid downloading huge vhd files locally or to some location & upload to ASH saving network bandwidth.

    You may be thinking of creating blob directly on Azure & can create image on ASH with the blob uri from Azure. It's not supported on neither Azure nor ASH. Both expect, blobs to be within the same subscription to create images.

    Also, I tried azcopy to copy from Azure to ASH with sas-tokens to speed up image copy. It didn't work as azcopy doesn't seem to be supported on ASH yet while they support GCP & AWS! What an irony!

    Give a try & let me know!