【问题标题】:azure cannot create vm from vhd imageazure 无法从 vhd 映像创建 vm
【发布时间】:2016-09-20 16:41:02
【问题描述】:

我目前在从自定义 VM 映像创建 Azure VM 时遇到困难。我从这里跟随 Azure 的指南:https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-capture-image/

我已使用 Waagent 并按照指示取消配置机器,并取消分配、通用化和捕获我的机器映像(我对 Azure 软件提供的核心 Ubuntu 16.04LTS 映像进行了一些修改)。我已经成功创建了 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 脚本底部运行部署命令时,我得到以下信息,它只是无限期地挂在这里.我是否使用正确的方法从自定义映像创建 VM?还是该 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

【问题讨论】:

    标签: linux powershell azure virtual-machine vhd


    【解决方案1】:

    我相信你的理解并不完整。如果你在最后一行看到它说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的截图供您参考-

    【讨论】:

    • 就是这样,提示永远不会出现。因此,如果我提交:“azure group deployment create $rgName $computerName -f $fileTemplate”,我看到两条信息行弹出,但 vmName、adminUserName、adminPassword 和 networkInterfaceId 的提示从未出现,它只是挂起“供应值”对于以下参数”,如显示的最后一行。它也不会让我提供输入。 Link To Photo
    • 让我尝试重现此错误。我会尽快回复您。
    • 我想知道你为什么使用:azure network vnet subnet create --resource-group $rgName --vnet-name $vnetName --name $subnetName --address-prefix $vnetSubnetAddressPrefix 而不是 azure network vnet subnet create $rgName $vnetName $subnetName 很抱歉,CLI 对我来说是新的
    • 我只是想详细说明一下,以防由于某种原因导致顺序不正确。我按照你指定的方式试了,结果还是一样
    猜你喜欢
    • 1970-01-01
    • 2017-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-07
    相关资源
    最近更新 更多