2016-07-10 42 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平台上创建用户图像的文档。 –

相关问题