Cannot start Windows Azure VM programmatically

2019-05-04 21:59发布

I'm performing REST API operation Start Role (http://msdn.microsoft.com/en-us/library/jj157189.aspx)

In the link https://management.core.windows.net/{subscription-id}/services/hostedservices/{service-name}/deployments/{deployment-name}/roles/{role-name}/Operations we have replaced {service-name}, {deployment-name} and {role-name} with name of VM.

In result we have next message: "ResourceNotFoundThe resource service name hostedservices is not supported."

List Hosted Services operation (http://msdn.microsoft.com/en-us/library/windowsazure/ee460781.aspx) shows us that we have 2 WMs as hosted services.

Get Role operaion (http://msdn.microsoft.com/en-us/library/jj157193.aspx) also gives info about each of VMs.

Thanks in advance.

标签: rest azure
3条回答
欢心
2楼-- · 2019-05-04 22:18

You are using:

{subscription-id}/services/hostedservices/{service-name}/deployments/{deployment-name}/roles/{role-name}/Operations

But the correct Uri is:

{subscriptionID}/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleInstanceName}/Operations

See the difference?

查看更多
姐就是有狂的资本
3楼-- · 2019-05-04 22:20

In my case, deployment name is the name of the first VM I created in this cloud service. So, if I added 3 machines to the same cloud service, all of them have the same deployment name - the name of the first machine.

查看更多
一夜七次
4楼-- · 2019-05-04 22:22

I haven't worked with this particular operation, however a few things:

service-name: It should be the name of the hosted service (the one with .cloudapp.net) and what you see when you list your hosted service.

deployment-name: Generally speaking it's a GUID returned by Get Deployment operation (http://msdn.microsoft.com/en-us/library/windowsazure/ee460804.aspx).

role-name: Role name is also returned when you do a Get Deployment operation. You should use that. I'm not sure if it is same as the name of your VM.

Can you retry your operation after changing these values?

查看更多
登录 后发表回答