0

Created a program to restart the Azure App Service instance programmatically. I am using below api to stop the w3wp process.

https://management.azure.com/subscriptions/{subscriptionid}/resourceGroups/{resourcegroup}/providers/Microsoft.Web/sites/{sitename}/instances/{instanceId}/processes/{processId}?api-version=2021-02-01

This is a DELETE (HttpVerb) call and it is throwing 403 - Forbidden error.

However i could execute GET calls for the same clientId. I would like to know whether it is an access issue with the clientid i am using or the approach am following to stop the process is not right.

If it is an clientId access issue, where to check it and what specific access has to be requested.

Kamal R
  • 51
  • 1
  • 4

1 Answers1

0

You should restart the App Service instead of trying to stop the w3wp process:

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart?api-version=2021-02-01

https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/restart

Using the CLI:

az webapp restart --name MyWebapp --resource-group MyResourceGroup

https://learn.microsoft.com/en-us/cli/azure/webapp?view=azure-cli-latest#az_webapp_restart

CSharpRocks
  • 6,791
  • 1
  • 21
  • 27
  • Thanks @CSharpRocks. I dont want to restart the webapp. But instead I am trying to restart the instance of the webapp. As we have more than 1 instance for the webapp, i am planning to restart each instance at a time to avoid the down time of the webapp. – Kamal R Nov 17 '21 at 10:38
  • By instance, you do you mean deployment slot? – CSharpRocks Nov 17 '21 at 12:52