你应该可以使用 获得部署 轮询角色的InstanceStatus(请注意InstanceStatus!= Status)。当InstanceStatus是ReadyRole时,您应该能够登录您的计算机。
部署状态和角色InstanceStatus之间存在区别。将角色视为实际虚拟机,而部署可以描述多个VM。
如果没有看到您的代码,很难确切地说出您需要做什么,但我建议您使用await关键字等待完成对Azure API的调用以创建VM。请参阅本MSDN指南中“部署虚拟机”下的代码示例: http://msdn.microsoft.com/en-us/library/azure/dn722415.aspx#bk_createres
SubscriptionCloudCredentials certificate = new CertificateCloudCredentials(subscriptionId, x509Certificate); IComputeManagementClient ComputeManagementClient = new ComputeManagementClient(certificate); var deployments = ComputeManagementClient.Deployments.GetBySlot(hostedServiceName, DeploymentSlot.YourDeploymentSlot); var state = deployments.RoleInstances.First().PowerState;
我希望这会对你有所帮助。