Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restart Azure Web App programmatically

Tags:

c#

azure

kudu

Is any way to restart the Azure Web App programmatically, i.e. Kudu or some another kind?

I'v found that it is possible using Management Libraries, but it is not applicable for me since I can't create application in AD.

like image 380
Laki State Avatar asked Apr 02 '17 21:04

Laki State


2 Answers

Powershell:

Restart-AzureRmWebApp -ResourceGroupName xxx -Name xxx

or using the provider operation:

Invoke-AzureRmResourceAction -ResourceGroupName xxx -ResourceType 'Microsoft.Web/sites' -ResourceName xxx `
  -ApiVersion '2015-08-01' -Action 'Restart' -Force

Azure Cli (nodejs, depreciated):

azure webapp restart --resource-group xxx --name xxx

Azure Cli (python):

az appservice web restart --resource-group xxx --name xxx

or you can use Rest Api

like image 157
4c74356b41 Avatar answered Oct 17 '22 07:10

4c74356b41


I'm assuming you're looking for this feature because you or folks on your team don't have elevated permissions on the Azure Portal.

Creating scripts will work, but it still requires someone to be comfortable with running command lines.

The best way I found to do this is with VSTS pipeline. A few clicks and it's restarted. A simple and awesome way to build a devops culture.

enter image description here

like image 1
jchang1 Avatar answered Oct 17 '22 09:10

jchang1