How to Reboot Specific Worker in Azure App Service
How to Reboot a Specific Instance in an App Service Plan
Azure provides a variety of services and tools that enable developers to build, deploy, and manage cloud applications. One of the key services offered by Azure is the Reboot Worker API, which enables users to reboot their virtual machines in a cloud environment.
When a worker instance is rebooted, the App Service is immediately moved to a new instance. This process is quicker rather than waiting for the VM to restart, but it is also advantageous as moving an App Service to a new instance can cure many ills that the App Service is experiencing.
There is an API used for instance reboot. This will reboot your instance, and thus, it will assign you to another worker instance. You will find the documentation at - Reboot Worker
Calling the Reboot Worker API from Microsoft Learn
After pressing “Try It”, you will be presented with the login screen on the right side of the screen. After logging in, you will get the following screen:
Parameters:
Name: App Service Plan Name
resourceGroupName: Resource Group of your App Service Plan
subscriptionId: The Subscription your App Service Plan is under
workerName: The name of the worker instance.
Api-Version: The date of the lastest API release
At the bottom of the screen, you’ll see a request preview:
Press RUN ▶ and the API will do its magic.
Calling the Reboot Worker API from Azure CLI
You can also use Azure CLI to call the API directly without the need to specify an authentication token. You would call the API using the “az rest” command. You will need to login to Azure CLI and, if necessary, set the subscription prior to executing the “az rest” command.
az rest –method POST –uri /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot?api-version=2022-03-01