检查一个VM的Azure运行 [英] Check if an Azure VM is running

查看:240
本文介绍了检查一个VM的Azure运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要查询现有蔚蓝的虚拟机来检查是否全面部署,并能够进行远程连接。有没有办法做到这一点使用Azure的REST API?

我已经概述我目前的进程,所以我希望下面这样的电话。

我使用的是的Windows Azure管理库来创建虚拟机使用 ComputeManagementClient CreateDeploymentAsync 功能。这然后返回成功,如果我再做一个get的状态上部署有 DeploymentStatus.Running 的状态。

在此已经用完,我想创建一个远程PowerShell连接,这样我就可以格式化磁盘。我一直在这得到一个错误,因为它无法创建会话。


  

的WinRM不能完成操作。验证指定的计算机名是有效的,计算机可以通过网络访问,并且为WinRM服务的防火墙例外启用,并允许从这台计算机的访问。默认情况下,公开个人资料的限制将WinRM防火墙例外访问远程计算机在同一个本地子网中。欲了解更多信息,请参阅about_Remote_Troubleshooting帮助主题。


如果我去Azure管理门户的地位供应,我想这是为什么我不能创建一个会话。

过程

  CreateAzureVM()
CheckAzureVmCanBeConnectedTo()//我不能这样做正确
RunPowershellScriptOnVM()/​​/失败


解决方案

您应该能够使用的获取部署来轮询角色的InstanceStatus(注意InstanceStatus!=状态)。当InstanceStatus是ReadyRole,你应该能够登录到您的计算机。

有一个部署的地位和角色InstanceStatus之间的区别。觉得作为一个实际的虚拟机的作用,而部署可以描述多个虚拟机。

I want to query an existing azure virtual machine to check whether it is fully deployed and able to be connected to remotely. Is there any way to do this using the Azure Rest API?

I've outlined my current process and why I desire such a call below.

I am using the Windows Azure management library to create a VM using ComputeManagementClient and the CreateDeploymentAsync function. This then returns a status of Succeeded, if I then do a get on the deployment it has a status of DeploymentStatus.Running.

After this has run I am trying to create a remote powershell connection so I can format the disk. I keep getting an error on this as it is unable to create the session.

WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.

If I go to the azure management portal the status is provisioning, I assume this is why i cannot create a session.

Process

CreateAzureVM()
CheckAzureVmCanBeConnectedTo() //I am unable to do this correctly
RunPowershellScriptOnVM() // this fails

解决方案

You should be able to use Get Deployment to poll for the role's InstanceStatus (note that InstanceStatus != Status). When the InstanceStatus is ReadyRole, you should be able to log into your machine.

There's a distinction between a Deployment status and a Role InstanceStatus. Think of the role as an actual virtual machine, whereas a Deployment may describe multiple VMs.

这篇关于检查一个VM的Azure运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆