marcus
marcus

Reputation: 10086

Restart Azure web app (aspnet5 rc1-final) deployed using Appveyor

I'm using Appveyor to deploy my aspnet5 (rc1-final) site to an Azure web app (site) using Web deploy. The deployment step works fine but I need to restart the site manually using the Azure portal and that is pretty annoying.

What I have read is that the web app does not restart automatically?

I have tried to use powershell to restart the site but it doesn't seem to work, or I'm doing something wrong?

This is the powershell script I use atm.

after_deploy:
 - ps: Disable-AzureDataCollection
 - ps: Select-AzureSubscription -Current -SubscriptionName "Visual Studio Premium with MSDN"
 - ps: Restart-AzureWebsite -Name "sitename"

I tried using just - ps: Restart-AzureWebsite -Name "sitename" but Azure complained about the subscription name so I added that. I'm using Visual Studio Premium with MSDN it's pretty obvious that it does not work as subscription name?

Select-AzureSubscription : The subscription name Visual Studio Premium with MSDN doesn't exist.

Is it possible to restart the site using powershell or is this a dead end?

Upvotes: 2

Views: 224

Answers (2)

David Ebbo
David Ebbo

Reputation: 43193

You are using the old PowerShell CmdLets. Please install the latest, which is currently 1.0.1.

With the latest, the CmdLet you want to run is:

Restart-AzureRmWebApp YourResourceGroup YourWebApp

As for authentication from a CI server, the recommended approach is to use a Service Principal. See this post for details.

Upvotes: 1

karlbarbour
karlbarbour

Reputation: 352

You're trying to connect to your Azure subscription named 'Visual Studio Premium with MSDN' - I very much doubt this is your subscription.

List out subscriptions you are authorised to: Get-AzureSubscription

Find the name of the one you wish to deploy to and change to:

 Select-AzureSubscription -Current -SubscriptionName "<Correct name here>"

Upvotes: 0

Related Questions