Over a million developers have joined DZone.

Pre-Role Startup Tasks for Windows Azure

DZone's Guide to

Pre-Role Startup Tasks for Windows Azure

· Cloud Zone ·
Free Resource

Site24x7 - Full stack It Infrastructure Monitoring from the cloud. Sign up for free trial.

Imagine you need to boot up a web role in the cloud, but before the global.asax events kick in or even lower, before the WebRoleEntryPoint events kick in, you need to do some installations of prerequisite software.

The best way to go about doing this is to register a task in the ServiceDefinition.csdef file. Lets imagine we need to run a batch file that will do some sort of installation, say a monitoring service that is required to be installed BEFORE IIS starts our web application, so that it can get a hook point, say New Relic!

Below is a configuration example that will do this for you.


You can also set elevation privileges, which are required if you are running PowerShell scripts etc.

Task commandLine="Startup.cmd" executionContext="elevated" taskType="background"

You can read more about this here:




So, I hope you now have a cool way to bootstrap your prerequisite software before IIS kicks in.


Site24x7 - Full stack It Infrastructure Monitoring from the cloud. Sign up for free trial.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}