如何启动Azure VM(解除分配)使用REST API
我在这里发现了一个非常奇怪的问题: 在Azure powershell中,我们可以使用 启动AzureVM-服务名称“mypc”-名称“mypc” 对于这两种VM状态=停止或停止(解除分配)。 但是对于Azure管理API 我们只能对VM state=stop使用 VM state=stop(解除分配)无法使用该API。。 如何使用RESTAPI在State=Stop(deallocated)的情况下启动VM?如何启动Azure VM(解除分配)使用REST API,azure,azure-powershell,Azure,Azure Powershell,我在这里发现了一个非常奇怪的问题: 在Azure powershell中,我们可以使用 启动AzureVM-服务名称“mypc”-名称“mypc” 对于这两种VM状态=停止或停止(解除分配)。 但是对于Azure管理API 我们只能对VM state=stop使用 VM state=stop(解除分配)无法使用该API。。 如何使用RESTAPI在State=Stop(deallocated)的情况下启动VM? 谢谢。Windows Azure PowerShell cmdlet使用服务管理RE
谢谢。Windows Azure PowerShell cmdlet使用服务管理REST API,但它使用的是2013-06-01版本。此操作可能仅在服务管理REST API的未记录版本中可用
通过使用代理请求,您可以看到cmdlet的实际功能—这使您可以访问调用的操作(URL)以及发送和接收的负载。或者,您可以查看GitHub上提供的PowerShell cmdlet。Windows Azure PowerShell cmdlet使用服务管理REST API,但它使用的是2013-06-01版本。此操作可能仅在服务管理REST API的未记录版本中可用
POST https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deployments/<deployment-name>/roleinstances/<role-name>/Operations
**x-ms-version: 2013-06-01**
<StartRoleOperation xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><OperationType>StartRoleOperation</OperationType></StartRoleOperation>
通过使用代理请求,您可以看到cmdlet的实际功能—这使您可以访问调用的操作(URL)以及发送和接收的负载。或者,您可以查看GitHub上提供的PowerShell cmdlet。POSThttps://management.core.windows.net//services/hostedservices//deployments//roleinstances//Operations
POST https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deployments/<deployment-name>/roleinstances/<role-name>/Operations
**x-ms-version: 2013-06-01**
<StartRoleOperation xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><OperationType>StartRoleOperation</OperationType></StartRoleOperation>
**x-ms-version:2013-06-01**
星形操作
POSThttps://management.core.windows.net//services/hostedservices//deployments//roleinstances//Operations
**x-ms-version:2013-06-01**
星形操作
公共任务StartVirtualMachineAsync(字符串订阅ID、字符串名称、字符串资源组)
{
TokenCloudCredentials tokenCloudCredential=新的TokenCloudCredentials(subscriptionId,token);
ComputeManagementClient ComputeManagementClient=新的ComputeManagementClient(tokenCloudCredential);
返回computeManagementClient.VirtualMachines.StartAsync(资源组,名称);
}
公共任务StartVirtualMachineAsync(字符串订阅ID、字符串名称、字符串资源组)
{
TokenCloudCredentials tokenCloudCredential=新的TokenCloudCredentials(subscriptionId,token);
ComputeManagementClient ComputeManagementClient=新的ComputeManagementClient(tokenCloudCredential);
返回computeManagementClient.VirtualMachines.StartAsync(资源组,名称);
}
您好,我尝试了fiddler,但它对我不起作用,因为代理请求将获得403禁止问题,cmdlet将首先发送get-request以获取vm信息,然后发送post请求,如果使用fiddler,则只能获得get请求,然后将导致403问题,我有什么不对劲吗?是的,使用x-ms-version:2013-06-01可以解决问题,但我仍然想知道如何使用fiddler作为代理,但不获取403 Fobidden您将您的Windows Azure身份验证证书放入%USERPROFILE%\My Documents\Fiddler2\ClientCertificate.cer我花了这么多时间在这方面,结果发现这是一个未记录的api问题。Grr.Hi我尝试了fiddler,但它对我不起作用,因为代理请求将获得403禁止问题,cmdlet将首先发送get请求以获取vm信息,然后发送post请求,如果使用fiddler,则只能获得get请求,然后将导致403问题,我有什么不对劲吗?是的,使用x-ms-version:2013-06-01可以解决问题,但我仍然想知道如何使用fiddler作为代理,但不获取403 Fobidden您将您的Windows Azure身份验证证书放入%USERPROFILE%\My Documents\Fiddler2\ClientCertificate.cer我花了这么多时间在这方面,结果发现这是一个未记录的api问题。谢谢,你的回答也帮助了我!谢谢,你的回答也帮助了我!