Before deployment script

Michal's Avatar


30 Jul, 2018 11:33 AM


we have multiple environments we deploy to (all of them are web apps on azure). And since sometimes there is a problem with locked files, the deployment fails. I wanted to add script for every environment to first stop the app but "before deploy" script is ran just once before all of the deployments and that's not what we really want since I would have to stop all of them before and I just want to stop the ones that are being deployed to. I found pre-sync deployment command, but i believe it doesn't work with azure web app (or is there some option for it?) since i get this error:

Could not complete an operation with the specified provider ("runCommand") when connecting using the Web Management Service. This can occur if the server administrator has not authorized the user for this operation. runCommand  Learn more at:
So my question is if there is some way to run a script for each environment deployment or if you know some way how to solve the problem with files being locked ("Take ASP.NET application offline during deployment" is enabled)
Warning: An error was encountered when processing operation 'Delete Directory' on 'logs'.
Retrying operation 'Delete' on object dirPath (xxx\logs). Attempt 5 of 5.
  1. 1 Posted by Ilya Finkelshte... on 30 Jul, 2018 12:15 PM

    Ilya Finkelshteyn's Avatar

    There are number of options:

    But instead I would recommend to move to Zip push deploy. If you are not using parametrization, nothing should hold you. But if you are using it, you can switch to app settings.

  2. 2 Posted by Michal Krajcovi... on 30 Aug, 2018 09:21 AM

    Michal Krajcovic's Avatar

    so I have discussed our options with colleagues and we can't really kill/stop azure website since we have 28 different deployments for that build and we don't want to stop all of them if just few deployments are selected. Is there a way to maybe get information on which deployments are actually selected so we can stop just the ones that are being deployed?

  3. 3 Posted by Ilya Finkelshte... on 30 Aug, 2018 10:07 PM

    Ilya Finkelshteyn's Avatar

    Sorry, I should have read initial question better. Now I understand that you need to selectively run the scripts for specific websites. Can you please look at This involves some effort for initial setup, but we will help you in this process if you decide to go ahead with this solution.

  4. Ilya Finkelshteyn closed this discussion on 04 Sep, 2018 09:27 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac