Start-up tasks
Start-up tasks are command-line scripts that can be added to a role in the ServiceDefinition.csdef
file, allowing the role to perform activities before the role has started. These activities might be things such as installing a third-party package or making environmental or configuration changes. Start-up tasks are the best way of customizing a server rather than making manual changes using a remote desktop. We're going to have a very brief look at this area, so it's worth doing some additional reading around this area yourself.
Creating a batch script
To get started, we need to create a .cmd
batch script to perform a task (you can also write PowerShell .ps1
scripts) called DemoTasks.cmd
and put it in a solution folder called Tasks
:
Before we write the script, we'll set the Build Action property of the file to Content so that the file along with the Tasks
folder is copied to the output (bin
) folder, and Copy to Output Directory to Copy if newer so that the file is copied if it...