0

I did not find any documentation for how to copy vhd on azure using python api, can anyone help me... also i have tried to create instance from image on the vmdepot community but when i run the following command i got this error:

$ azure vm create instanceahmed -o vmdepot-14776-1-1 -l "West US" ahmed P@ssw0rd --ssh 22 --verbose
......
verbose: Creating VM
verbose: Deleting image
info:    VM image deleted: vmdepot-14776-1-1-c5febcb3
verbose: Uri : http://portalvhdsf4048vkh9c007.blob.core.windows.net/vm-images/community- 23970-525c8c75-8901-4870-a937-7277414a6eaa-1.vhd
info:    Blob deleted: http://portalvhdsf4048vkh9c007.blob.core.windows.net/vm- images/community-23970-525c8c75-8901-4870-a937-7277414a6eaa-1.vhd
info:    vm create command OK

2 Answers 2

2

I tried to do what "-o" do with Azure with these steps:

  1. Get the URL of your image on the community:

    http://vmdepoteastus.blob.core.windows.net/linux-community-store/community-23970-525c8c75-8901-4870-a937-7277414a6eaa-1.vhd
    
  2. Create a new affinity group if you have one skip this point:

    $ azure account affinity-group create mystoragegroup --location "West US"
    
  3. Create a new storage account if you have an account skip this point:

    $ azure storage account create mystorageazure --affinity-group mystoragegroup
    
  4. Get the Primary secret key of new storage account using this command:

    $ azure account storage keys list mystorageazure
    output:
    data:    Primary:  Your SECRET STORAGE KEY
    
  5. Create new account storage inside this storage account:

    $ azure storage container create  --permission Blob  -a mystorageazure  -k  Your SECRET STORAGE KEY  mycontainerazure
    
  6. Upload your image to the your account storage container:

    $ azure vm disk upload --verbose http://vmdepoteastus.blob.core.windows.net/linux-community-store/community-23970-525c8c75-8901-4870-a937-7277414a6eaa-1.vhd http://mystorageazure.blob.core.windows.net/mycontainerazure/elastichpcvm.vhd  Your SECRET STORAGE KEY
    
  7. Create your local image:

    $ azure vm image create mystorageimage --location "West US" --blob-url http://mystorageazure.blob.core.windows.net/mycontainerazure/elastichpcvm.vhd --os linux
    
  8. Create your virtual machine using your local image:

    $ azure vm create mystoragemachine  mystorageimage ahmed P@ssw0rd --location "West US" --ssh 22
    
Sign up to request clarification or add additional context in comments.

1 Comment

This is totally unrelated to the original question, but you helped me 2.5 years later with the last 3 steps with another problem! :)
-1

This seems to me like the cli issue. Can you please tell us

  • what version of the azure cli are you using. To get the version execute: azure -v
  • Can you provide us the version of publishsettings.xml file you are currently using? You can get the publishsettings xml file by executing: azure account download

1 Comment

my azure version is 0.7.2 my publishsettings version 2.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.