locked
How to restart a cloud service VM Role RRS feed

  • Question

  • Hi,

    I have PaaS VM role that need to be restart using Azure Management libraries. I tried following codes but failed with "BadRequest: The operation is not supported on a role of type MyPaaSVmName". But I successfully restarted IaaS VM using below Method1.

    1.

    ComputeManagementClient client = new ComputeManagementClient(cloudCredentials);

    client.VirtualMachines.Restart(hostedServiceName, deploymentName, vmName);

     

    2.

    ComputeManagementClient client = new ComputeManagementClient(cloudCredentials);

    VirtualMachineOperationsExtensions.Restart(client.VirtualMachines, hostserviceName, deploymentName, vmName);

    Thank you.


    - Vins


    • Edited by Vins007 Wednesday, December 3, 2014 4:40 PM typo
    Wednesday, December 3, 2014 3:22 PM

Answers

  • Ok, found the issue.

    in Method1, it should be like this as I am trying to restart a Role instance (PaaS VM),

    client.Deployments.RebootRoleInstanceByDeploymentName(hostserviceName, deploymentName, roleName);

    And, Method2 is wrong.


    - Vins

    • Marked as answer by Vins007 Thursday, December 4, 2014 4:09 PM
    Thursday, December 4, 2014 1:37 PM

All replies

  • Hi Vins,

    I would suggest you check your hostedServiceName, deploymentName, vmName, if all are correct, please give the detailed error message from azure portal MANAGEMENT SERVICES.

    Best Regards,

    Jambor 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, December 4, 2014 9:54 AM
  • Hi Jambor,

    I can confirmed all parameters are correct, So I am wondering whether this is NOT possible on PaaS VMs. Here is top part of the error by omitting my libraries details.

    "BadRequest: The operation is not supported on a role of type BackendServiceV1WebRole_IN_1.   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
       at Microsoft.WindowsAzure.VirtualMachineOperationsExtensions.Restart(IVirtualMachineOperations operations, String serviceName, String deploymentName, String virtualMachineName"

    Thanks,


    - Vins

    Thursday, December 4, 2014 11:41 AM
  • Ok, found the issue.

    in Method1, it should be like this as I am trying to restart a Role instance (PaaS VM),

    client.Deployments.RebootRoleInstanceByDeploymentName(hostserviceName, deploymentName, roleName);

    And, Method2 is wrong.


    - Vins

    • Marked as answer by Vins007 Thursday, December 4, 2014 4:09 PM
    Thursday, December 4, 2014 1:37 PM
  • Hi,

    Thank you for sharing your solutions and experience here. It will be very beneficial for other community members who have similar questions. If you have any difficulty in future programming, we welcome you to post in forums again.

    Best Regards,
    Jambor


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, December 5, 2014 12:59 AM