2016-09-20 139 views
0

我目前正在从自定义VM映像创建Azure VM时遇到困难。 https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-capture-image/azure无法从vhd图像创建vm图像

我已经使用Waagent并根据指示取消配置了机器,并取消分配,概括并捕获了我的机器映像(我对Ubuntu 16.04LTS核心映像进行了一些修改可从Azure软件获得)。我已经成功创建了template.json文件(如果需要,可以提供它)。然后,我完成了本文中概述的PowerShell脚本中的所有任务,只是将参数提取到变量以使事情变得更简单。

## Global 
$rgName = "testrg" 
$location = "eastus" 

## Storage 
$storageName = "teststore" 
$storageType = "Standard_GRS" 

## Network 
$nicname = "testnic" 
$subnetName = "subnet1" 
$vnetName = "testnet" 
$vnetAddressPrefix = "10.0.0.0/16" 
$vnetSubnetAddressPrefix = "10.0.0.0/24" 
$ipName = "TestIP" 

## Compute 
$vmName = "testvm" 
$computerName = "testcomputer" 
$vmSize = "Standard_D1_v2" 
$osDiskName = $vmName + "osDisk" 

#template 
$fileTemplate = "C:\AzureTemplate\template.json" 

azure group create $rgName -l $location 

azure network vnet create $rgName $vnetName -l $location 

azure network vnet subnet create --resource-group $rgName --vnet-name $vnetName --name $subnetName --address-prefix $vnetSubnetAddressPrefix 

azure network public-ip create $rgName $ipName -l $location 

azure network nic create $rgName $nicName -k $subnetName -m $vnetName -p $ipName -l $location 

azure network nic show $rgName $nicname 

azure group deployment create $rgName $computerName -f $fileTemplate 

我能够成功运行所有的命令来创建资源组和网络组件中,但是,当我试图在PowerShell脚本的底部运行部署命令,我得到以下并只是无限期地挂在这里。我是否使用正确的方法从自定义图像创建虚拟机?或者,Azure指南过时了吗?

azure group deployment create $rgName $computerName -f $fileTemplate 
[32minfo[39m: Executing command [1mgroup deployment create[22m 
[32minfo[39m: Supply values for the following parameters 

编辑:链接到图像显示问题:http://imgur.com/a/Fgh8K

回答

0

我相信你的理解是不完整的。如果您在最后一行看到它,则表示Supply values for the following parameters

您需要传递VM名称,管理用户名和密码的值以及先前创建的NIC的ID。我是你应该重新阅读文档。下面是从https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-capture-image/#deploy-a-new-vm-from-the-captured-image供大家参考截图 -

enter image description here

+0

那东西,是永远不会迅速出现。因此,如果我提交:“azure组部署创建$ rgName $ computerName -f $ fileTemplate”,我看到两条信息线弹出,但vmName,adminUserName,adminPassword和networkInterfaceId的提示不会出现,它只是挂起“供应值对于以下参数“作为最后一行显示。它也不会让我提供意见。 [链接到照片](http://imgur.com/a/Fgh8K) –

+0

让我试着重现这个错误。我会尽快回复你。 – Atf

+0

我可以知道你为什么使用:'Azure网络vnet子网创建 - 资源组$ rgName --vnet名称$ vnetName - 名称$ subnetName - 地址前缀$ vnetSubnetAddressPrefix'而不是'Azure网络vnet子网创建$ rgName $ vnetName $ subnetName'我很抱歉,但是CLI对我来说是新的 – Atf