Adding environment variables to APP Pool¶
The following example adds an environment variable to an application pool.
<applicationpools>
<add managedpipelinemode="Classic" managedruntimeversion="v4.0" name="Contoso">
<environmentvariables>
<add name="foo" value="bar"></add>
</environmentvariables>
</add>
</applicationpools>
you can also add environment vars using appcmd tool
%systemroot%\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/applicationPools /+"[name='Contoso'].environmentVariables.[name='foo',value='bar']" /commit:apphost