-->

How to add a custom post deployment script to azur

2020-02-04 06:13发布

问题:

My problem is that I need to run a custom cmd file after the build. Instead of modifying the deployment scripts I just want to run few MSDOS commands to my deployment easily.

The task I need to do is to run a cmd at the repository located at /source/copyextrafiles.cmd after the build succeeded.

How can I achieve that?

回答1:

At the azure portal on the CONFIGURE tab of your website add a "app settings" entry called POST_DEPLOYMENT_ACTION with the value of source/copyextrafiles.cmd Save and the next deploy will run the cmd for you after the deploy.

Here the picture:



回答2:

An alternative in addition to the solutions already provided is to copy the script in to a specific folder provided for post deployment action hooks.

So after creating a new directory in "D:\home\site\deployments\tools\" named "PostDeploymentActions", you could just add script files (.bat, .cmd or .ps1) into the directory and they will all run, one by one, after each deployment.