Search code examples
bashazureazure-storageazure-cli2

Upload vhd to Azure using Azure CLI


I am trying to upload a VHD to Azure using the Azure CLI. I am using Bash for Ubuntu for Windows. I am following these instruction https://learn.microsoft.com/en-us/azure/virtual-machines/linux/upload-vhd

Its at this stage here i get stuck and i am not sure what to do.

az storage blob upload --account-name mystorageaccount \ --account-key key1 --container-name mydisks --type page \ --file /path/to/disk/mydisk.vhd --name myDisk.vhd

I get the following error:

[Errno 2] No such file or directory: 'C:/_Downloads/myvhd.vhd'

The resource groups, storage disks created fine. How do i proceed?

Machine is windows 10 pro, latest SPs, node.js, bash for ubuntu for windows, azure cli installed


Solution

  • why do you need node.js? az uses python. old azure cli uses node.js, but you are clearly using new one (az - new vs azure -old).

    also, you should probably use a proper path like /mnt/c/_Downloads/myvhd.vhd. Since you are using WSL you should give it a path that makes sense in WSL.

    To access data on your hard drive, you should use the /mnt/ folder, it has all the drives mounted over there