You can create a launch task that runs with elevated privileges, as well as launch an application in a limited context. Your service configuration file should look like this:
<ServiceDefinition name="MyCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-10.1.8"> <WebRole name="MyWebRole" vmsize="Small"> <Runtime executionContext="limited"> </Runtime> <Startup> <Task executionContext="elevated" commandLine="scripts\SetupCulture.cmd" taskType="simple"> <Environment> <Variable name="CULTURE"> <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/ConfigurationSettings/ConfigurationSetting[@name='Culture']/@value" /> </Variable> </Environment> </Task> </Startup> ... </WebRole> </ServiceDefinition>
Please note that you can specify the desired culture in the service configuration file. Finally, you can use the "CULTURE" environment variable in your .cmd file to use it as a parameter of the .NET executable executing the job.
source share