Javier Hertfelder
Javier Hertfelder

Reputation: 2432

Remove automatically Azure Staging Services

I would like to use Azure Automation to delete all the staging deployments in my cloud services. I would like to run a Powershell script once a day to do so.

Is there any predefined script out there to do so? Any examples?

Upvotes: 2

Views: 586

Answers (1)

neolursa
neolursa

Reputation: 432

the following Powershell cmdlet can be used to delete deployment slots on a website.You can either loop thru the list of deployment slots or do one by one.

Remove-AzureWebsite -Name webappslotstest -Slot staging

There's three ways to do this;

  • Running this on a VM or a client machine
  • Running this as a Webjob in the webapp as powershell script (I'd go with this one)
  • Azure Automation as you've asked. You can use a Runbook for this, here you can find more info on runbooks and sample scripts.

Hope this helps

Upvotes: 4

Related Questions