none
vhd file exists - The specified resource does not exist!

    Question

  • Hello,

    I had created in past a vhd file from a linux virtual machine, as a backup plan, and now I want to use it to create from this file a new virtual machine (via PowerShell commands), but I can not find it!

    From Azure Portal, more services, Storage Account (classic), choose the name of storage, Overview, blobs and folder, I can view a .vhd file, but if I copy the url link (https://<storage name>.blob.core.windows.net/vhds/<file-name>.vhd) and paste it to a browser, then I get the following message:
    "The specified resource does not exist. RequestId:bec7d540-0001-0014-7d79-03cece000000 Time:2016-08-31T11:19:05.4409605Z".

    Moreover I get an error message from PowerShell console too, when I try to create vm with New-AzureVM command:
    "New-AzureVM : BadRequest: A disk with name ..... (name of the disk) does not exist in the subscription.".
    Do anyone have any idea what is this issue and how could I solve it?

    Thank you in advance,

    George


    George Koukas Information Technology and Services

    Wednesday, August 31, 2016 11:36 AM

Answers

  • Hi again,

    OK I find the solution: first I remove the old image with Remove-AzureVMImage -ImageName "xxxxx" and then I create a new one with Add-AzureVMImage.

    Regards,


    George Koukas Information Technology and Services

    • Marked as answer by George Koukas Wednesday, August 31, 2016 3:59 PM
    Wednesday, August 31, 2016 3:58 PM

All replies

  • You wont be able to directly hit the blob file using URL, however you can validate if the Page blob exists in the storage account using snippet below and observe all the properties of it.

    $StorageAccounts = Get-AzureStorageAccount "storage_account_name" $key =Get-AzureStorageKey -StorageAccountName $StorageAccounts.StorageAccountName $storageContext = New-AzureStorageContext -StorageAccountName $StorageAccounts.StorageAccountName -StorageAccountKey $key.Primary $blob = Get-AzureStorageBlob -Blob "diskname.vhd" -Container "vhds" -Context $storageContext

    $blob.ICloudBlob.Uri.ToString()

    and then follow steps mentioned in this article to create new VM from existing OS disk

    https://social.msdn.microsoft.com/forums/azure/en-US/b8cbf55c-41c1-42f5-bc20-a45e6af55b61/powershell-syntax-for-adding-a-vm-with-an-existing-os-disk


    Bhushan | Blog | LinkedIn | Twitter


    Wednesday, August 31, 2016 12:33 PM
  • Hello,

    thank you for your reply. I tried your script and actually $blob.ICloudBlob.Uri.ToString() returns me back the same uri that I have copied from portal (https://<storage name>.blob.core.windows.net/vhds/<file-name>.vhd).

    I try to create an image from this vdisk file with command: Add-AzureVMImage -ImageName $disk -MediaLocation $vd -OS "Linux", where $vd =  $blob.ICloudBlob.Uri.ToString(), but I got another error:
    "Add-AzureVMImage : ConflictError: The VHD https://xxxxxx.blob.core.windows.net/vhds/xxxxxxxxxxxx.vhd is already registered with image repository as the resource with ID xxxxxx."

    I have to mention that this vhd file is unlocked and its lease state is broken - I view it by CloudXplorer app.

    So the vhd file is there, but I cannot use it! Ιf you have a second thought please share it!

    Regards,


    George Koukas Information Technology and Services

    Wednesday, August 31, 2016 3:15 PM
  • Hi again,

    OK I find the solution: first I remove the old image with Remove-AzureVMImage -ImageName "xxxxx" and then I create a new one with Add-AzureVMImage.

    Regards,


    George Koukas Information Technology and Services

    • Marked as answer by George Koukas Wednesday, August 31, 2016 3:59 PM
    Wednesday, August 31, 2016 3:58 PM