As you may know that both “Startup task” and OnStart() function, are executed before your Role, Run function is called. You might have a question in your mind, if there any advantage of using startup task over executing the installation code in OnStart()?
In general, there is no conceptual difference between OnStart and a Startup task, however there are several small implementation details, that would make you choose one or the other:
One of the best article I found on MSDN. Very good information. Thank you for great work.