Getting curl(52) error when triggering start VM rest API via curl

karthikeyan 0 Reputation points
2023-09-13T15:26:31.5166667+00:00

Hi All, I am trying to generate oauth token via curl which I can fetch without any issue... and from there we are getting the access token... passing those access token in curl command to trigger the rest API to start or stop VM scaleset start. But am getting an curl error... same script in form power shell it's working fine without any issue. Command :curl -X POST -H "Authorization: Bearer ${header}" -H "Content-Type: application/JSON" "Https://management.azure.com/subscription/$subscription/resourcegroup/$rgname/providers/Microsoft.Compute/VirutalMachineScaleSets/$vmname/start?api-version=$apiversion error : curl: (52) Empty reply from server

Azure Virtual Machine Scale Sets
Azure Virtual Machine Scale Sets
Azure compute resources that are used to create and manage groups of heterogeneous load-balanced virtual machines.
365 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. deherman-MSFT 35,636 Reputation points Microsoft Employee
    2023-09-15T18:19:49.2533333+00:00

    @karthikeyan

    The error message "curl: (52) Empty reply from server" indicates that the server did not send a response back to the client. This could be due to a network issue or a problem with the server.

    Regarding your command, it seems that you are trying to start or stop a VM scaleset using a REST API call with a bearer token. However, it is not clear from the information you provided what could be causing the error.

    I suggest you check the following:

    • Make sure that the subscription ID, resource group name, VM scaleset name, and API version are correct.
    • Verify that the bearer token is valid and has the necessary permissions to start or stop the VM scaleset.
    • Check if there are any network issues that could be causing the problem.

    You can also refer to the following document for more information that might be helpful: https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/qs-configure-rest-vmss

    Let me know if this helps. If you need further assistance, let me know and we can connect you directly to a support engineer.


    If you still have questions, please let us know in the "comments" and we would be happy to help you. Comment is the fastest way of notifying the experts.

    If the answer has been helpful, we appreciate hearing from you and would love to help others who may have the same question. Accepting answers helps increase visibility of this question for other members of the Microsoft Q&A community.

    Thank you for helping to improve Microsoft Q&A!

    User's image