1
votes

I have an Azure Function App / Azure Website setup with continuous deployment from source-control.

This App has a custom deployment script that takes quite a bit of time to run. Occasionally I push out a change to git which was a mistake, and I want to cancel that one deployment (While still allowing future git pushes to cause a deployment).

Is there a PowerShell command I can run, or some option which will cancel my current deployment?

3

3 Answers

2
votes

I was able to figure this out eventually, and figured I'd post it here. There is no "clean" way to do this, but there is a "hack".

  1. Navigate to your SCM site:

    [YOUR_WEBSITE].scm.azurewebsites.net

  2. Click on "Process Explorer"

  3. Find the process which is the current deployment and choose "Properties".

  4. Scroll to the bottom of the page and choose "Kill"

VoilĂ , you've killed your deployment in the middle.

0
votes

There's nothing simple as far as I know.

It's possible that deleting the deployment via kudu rest apis (https://github.com/projectkudu/kudu/wiki/REST-API#deployment) would achieve what you want, but I expect that that will fail during deployment / only delete metadata and logs about the deployment.

Also, cancelling a deployment could leave unwanted artifacts in the filesystem / corrupt your web app. It's probably best to modify your deployments so that you have a development branch and a release branch in order to set up a more robust CI scenario.

0
votes

Just run this small az-cli command. It will stop/kill your current deployment.

az webapp deployment source delete --name MyWebApp --resource-group MyResourceGroup

Once it's done, you can try deploying your webapp again!