Laki State
Laki State

Reputation: 71

How to restart Azure Web App programmatically

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.

Upvotes: 7

Views: 10843

Answers (3)

Raj Rao
Raj Rao

Reputation: 9138

Check out this answer, which uses a LogicApp to make it a nice lightweight way to restart your web-app: https://stackoverflow.com/a/59633629/44815

Upvotes: 0

4c74356b41
4c74356b41

Reputation: 72191

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

Upvotes: 13

jchang1
jchang1

Reputation: 497

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

Upvotes: 2

Related Questions