简体   繁体   中英

Creating VM From Azure Platform Images with Rest API

I am trying to Create Virtual Machine Deployment operation through azure rest API as of the documentation here .

But I fail to figure out parameters to create a VM with a OSImage(like Ubuntu 14.04). What should be the values for SourceImageName and MediaLink of OSVirtualHadrDisk?

You can easily get a list of available image names using Get-AzureVMImage from the Azure PowerShell Cmdlets.

Get-AzureVMImage | where { $_.ImageFamily -like "*ubuntu*14.04*" } | Sort-Object PublishedDate | Format-List ImageFamily, ImageName

...
ImageFamily : Ubuntu Server 14.04 LTS
ImageName   : b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20140927-en-us-30GB

ImageFamily : Ubuntu Server 14.04 LTS
ImageName   : b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20141125-en-us-30GB

ImageFamily : Ubuntu Server 14.04 LTS
ImageName   : b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20150123-en-us-30GB
...

So, for example, your SourceImageName would be as follows for the image published 01-23-2015:

b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20150123-en-us-30GB

The MediaLink is the name and location of the VHD that is created for your virtual machine. It can be any name you want provided it resides in your Azure Storage Account. For example:

https://[YOUR STORAGE ACCT NAME].blob.core.windows.net/vhds/[SOME UNIQUE NAME].vhd  

If you want to see an example, create a Virtual Machine in your subscription using the Azure Management Portal and then look at the Disks section of the DASHBOARD page for your Virtual Machine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM