【发布时间】:2017-04-26 23:53:09
【问题描述】:
所以我正在尝试通过 Powershell 从 VHD(从在 Hyper-V 中运行的服务器)创建 Azure VM。创建过程失败并出现以下错误:
New-AzureRmVM : Long running operation failed with status 'Failed'.
ErrorCode: VMAgentStatusCommunicationError
ErrorMessage: VM 'Server' has not reported status for VM agent or extensions. Please verify the VM has a running VM agent, and can establish outbound connections to Azure storage.
StartTime: 4/24/2017 12:26:57 PM
EndTime: 4/24/2017 12:52:39 PM
OperationID: 71739dce-4052-4114-82a4-dda1c3476711
Status: Failed
At line:10 char:7
+ $vm = New-AzureRmVM -VM $VMconfig -Location $location -ResourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmVM], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand
我已将 Azure VM 代理安装到 Hyper-V 中的虚拟机上。我阅读了有关该错误的following post,并且 cmets 中的某个人说您需要允许 https 访问存储帐户。我在设置中到处找,我不知道该怎么做。我错过了什么吗?会不会有其他原因导致失败?
此外,创建的 azure 虚拟机看起来运行良好,但我无法对其进行 RDP,即使我在上传 vhd 之前启用了远程桌面连接。
任何帮助将不胜感激。
提前致谢!
编辑:这是我的源代码:
Login-AzureRmAccount
$vhdname = Read-Host "Please enter the new name of the VHD in Azure"
$vhdurl = "https://***********.blob.core.windows.net/******/$vhdname"
$resourcegroup = Read-Host "Please enter the Azure resource group for the VM"
$servername = Read-Host "Please enter name of Azure server to be created"
$virtualnetwork = Read-Host "Please enter the name of the Azure virtual network to be used"
$VMsize = Read-Host "Please enter the vm size in Azure (i.e. Basic_A0)"
$location = Read-Host "Please enter the region of the server (i.e. westus)"
$virtualnetworkinfo = Get-AzureRmVirtualNetwork -ResourceGroupName $resourcegroup -Name $virtualnetwork
$publicIp = New-AzureRmPublicIpAddress -Name $servername -ResourceGroupName $resourcegroup -Location $location -AllocationMethod Dynamic
$networkInterface = New-AzureRmNetworkInterface -ResourceGroupName $resourcegroup -Name "$servername`_VirtualNetworkInterface" -Location $location -SubnetId $virtualnetworkinfo.Subnets[0].Id -PublicIpAddressId $publicIp.Id
$VMconfig = New-AzureRmVMConfig -VMName $servername -VMSize $VMsize
$VMconfig = Set-AzureRmVMOSDisk -VM $VMconfig -Name $servername -VhdUri $vhdurl -CreateOption Attach -Windows
$VMconfig = Add-AzureRmVMNetworkInterface -VM $VMconfig -Id $networkInterface.Id
$vm = New-AzureRmVM -VM $VMconfig -Location $location -ResourceGroupName $resourcegroup
【问题讨论】:
-
能否请您添加用于创建 VM 的代码片段。此外,门户中“扩展”选项卡的屏幕截图以及此处列出的任何错误(如果与上述不同)。
-
你打开Azure NSG上的3389端口了吗?
-
@Jesse 你有 NSG 或防火墙块 443(出站)吗?
-
@CtrlDot 我将用我的代码编辑原始位
-
@Walter-MSFT 是的,我确实打开了 3389,但我没有阻止 443 出站。我应该这样做吗?
标签: powershell azure