Search code examples
azureazure-cloud-services

When is a Azure Cloud Startup Task Executed?


I have setup a startup task on my Azure Cloud Service for Web Role. It executes a startup.cmd file which installs a third party S/W on cloud. I have tested it on my local machine and it worked fine.

Now I have some questions about its execution on Azure Cloud Server:

  1. Will startup task execute as soon as I publish my application on server? Or I have to do something manually to get it executed.
  2. How can I get information about execution of startup task? like it's success, failure or is it executed or not? error messages and all.

Thank You


Solution

  • Answers to your questions from this link:

    Will startup task execute as soon as I publish my application on server? Or I have to do something manually to get it executed.

    Yes. You don't have to manually trigger these startup tasks. Please see Role Startup Order section in the link for more details.

    How can I get information about execution of startup task? like it's success, failure or is it executed or not? error messages and all.

    You can log the errors encountered during the execution of startup tasks in a directory specified by the TEMP environment variable. From the same link:

    Your startup task can log information and errors to the directory specified by the TEMP environment variable. During the startup task, the TEMP environment variable resolves to the C:\Resources\temp[guid].[rolename]\RoleTemp directory when running on the cloud.

    Startup tasks must end with an errorlevel (or exit code) of zero for the startup process to complete. If a startup task ends with a non-zero errorlevel, the role will not start.