Search code examples
powershellazureazure-storageazure-blob-storagevhd

Create a Disk in Azure New Portal is not working , old portal I could do it easily


I'm not even sure why azure even has a GUI Website. It is starting to feel a bit ridiculous when the old manage.windowsazure.com I could powershell up a VHD, and then very easily use a Storage and container and Add the image and then choose from gallery of my own images.

NOW I read that in May 2017 a lot of things with the old portal are going away. I created a Storage Account myvmblobs and then a container mywincontainer and then I uploaded a VHD , tmppro2.vhd is sitting there as a VHD Blob

URL https://myvmblobs.blob.core.windows.net/mywincontainer/TMPPRO2.VHD

So I read that I could create a Disk image from powershell ( I have to no way to do it with website portal.azure.com )

Add-AzureDisk 'tmppro2' -MediaLocation https://myvmblobs.blob.core.windows.net/mywincontainer/TMPPRO2.VHD -Label 'OS' -OS "Windows"

However, I don't know if the Label or OS is important...

Add-AzureDisk : BadRequest: The storage account with the name myvmblobs as specified in the VHD URI https://myvmblobs.blob.core.windows.net/mywincontainer/TMPPRO2.VHD does not exists in the current subscription


Solution

  • According to your description, we can use PowerShell or template to create new VM in Azure ARM module.

    About PowerShell, here is a example script(use existing VHD):

    $rgname = "jason-newgroup" 
    $loc = "japaneast" 
    $vmsize = "Standard_DS1_v2" 
    $vmname = "jason-newtest2" 
    $vm = New-AzureRmVMConfig -VMName $vmname -VMSize $vmsize 
    $nic = Get-AzureRmNetworkInterface -Name ("jason-newtest45") -ResourceGroupName $rgname 
    $nicId = $nic.Id 
    $vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nicId 
    $osDiskName = "jason-newtest" 
    $osDiskVhdUri = "https://jasonnewgroupdisks912.blob.core.windows.net/vhds/jason-newtest201681285042.vhd" 
    $vm = Set-AzureRmVMOSDisk -VM $vm -VhdUri $osDiskVhdUri -name $osDiskName -CreateOption attach -Linux 
    New-AzureRmVM -ResourceGroupName $rgname -Location $loc -VM $vm  
    

    Use template to create Azure VM:

    Here is the template.

    enter image description here

    Update:

    We can use azure storage explorer to upload VHD to Azure:

    enter image description here