【发布时间】:2017-01-02 15:46:43
【问题描述】:
我是 Azure power shell 世界的新手。我正在尝试创建 power shell 脚本来自动创建 VM。我的所有脚本运行良好,VM 也正在创建,但它被挂在最后一行。因此,即使创建了虚拟机,我的 power shell 脚本也会继续运行。请告诉我如何解决这个问题。
Write-Verbose 'Creating VM...'
$result = New-AzureRmVM -ResourceGroupName $resourceGroupName -Location $location -VM $vm
if($result.Status -eq 'Succeeded') {
Write-Verbose $result.Status
Write-Verbose ('VM named ''{0}'' is now ready, you can connect using username: {1} and password: {2}' -f $vmName, $adminUsername, $adminPassword)
}
else {
Write-Error 'Virtual machine was not created successfully.'
}
【问题讨论】:
-
能否提供完整的代码?
-
看这段代码没有人能得出任何结论。所以,请提供整个脚本
-
请参考此网址获取完整代码。
标签: powershell azure virtual-machine azure-blob-storage