2016-07-10 47 views
0

我看到了使用vhd文件創建圖像並使用該映像文件創建vm的示例。我使用手臂模式,並希望將我上傳的vhd列爲圖像。基本上我想要使用azure cli/java sdk在以下文章https://azure.microsoft.com/en-in/documentation/articles/virtual-machines-windows-classic-createupload-vhd/中執行第5步。我沒有看到這樣做的任何例子。 有一個cli命令'azure vm image create',但它是否已在azure-cli 0.10.1版中棄用?我已經爲mac安裝了預編譯的azure-cli版本。使用天藍色的cli創建自定義vhd的圖像

回答

0

據我所知,沒有證據表明在azure-cli 0.10.1版本中不支持命令azure vm image create。您現在可以通過命令npm update -g azure-cli將azure-cli版本升級到0.10.2。

對於做article的步驟5中,你可以嘗試參考文章使用的命令azure vm image createASM模式「天青CLI在Azure的服務管理(ASM)模式命令」的部分Commands to manage your Azure virtual machine images,請參閱下面的步驟。

# Sets the cli wording mode with asm 
$ azure config mode asm 
# See the help manual for the command `vm image create` 
$ azure vm image creaet -h 
help: Upload and register a VM image 
help:  
help: Usage: vm image create [options] <name> [source-path] 
help:  
help: Options: 
help:  -h, --help     output usage information 
help:  -v, --verbose    use verbose output 
help:  -vv       more verbose with debug output 
help:  --json      use json output 
help:  -u, --blob-url <url>   the target image blob url 
help:  -l, --location <name>  the location 
help:  -a, --affinity-group <name> the affinity group 
help:  -o, --os <type>    the operating system [linux|windows] 
help:  -p, --parallel <number>  the maximum number of parallel uploads [96] 
help:  -m, --md5-skip    skip MD5 hash computation 
help:  -f, --force-overwrite  Force overwrite of prior uploads 
help:  -e, --label <about>   the image label 
help:  -d, --description <about> the image description 
help:  -b, --base-vhd <blob>  the base vhd blob url 
help:  -k, --source-key <key>  the source storage key if source-path 
help:        is a Microsoft Azure private blob url 
help:  -s, --subscription <id>  the subscription id 
help:  
help: Current Mode: asm (Azure Service Management) 
# Does the step 5 like Azure-AddVMImage 
$ azure vm image create <ImageName> -b <vhd-blob-url> -o <ostype: linux|windows> 

同時,我認爲從創建自定義圖像虛擬機的簡單方法是使用Azure的CLI與ARM從模板,你可以參考articlethe template sample GitHub上。

+0

謝謝彼得。我在ARM模式下工作,我已經將我的vhd blob上傳到其中一個資源組。現在我只需要從這個vhd文件中創建一個圖像。在預覽門戶網站上似乎也無法做到這一點。那麼,沒有使用模板的話,沒有辦法做到這一點嗎? –

+0

由於ARM是建議在任何地方使用的,我想找到一種使用資源組創建自定義圖像的方法。幾乎沒有任何關於在非Windows平臺上創建用戶圖像的文檔。 –

相關問題