New Azure Web Sites feature: configurable environment variables
Publicado el 21 marzo, 2014
One of Azure’s most popular and powerful features is XML Document Transformation (XDT), which allow you to transform the content of the ApplicationHost.config file in your Windows Azure web sites site. Using this process, you can install site extensions such as Kudu and Monaco. Using site extensions, the out-of-the-box abilities of Azure Web Sites are virtually limitless. One challenge with 3rd party site extensions is that many of them require specific configuration settings. For example, New Relic's .NET agent requires several configuration keys (COR_ENABLE_PROFILING, COR_PROFILER, COR_PROFILER_PATH and NEWRELIC_HOME). This is not difficult to do for the developer when installing the agent on his Azure Web Site (by dropping a custom XDT in the right place), but if New Relic wanted to create an automatic installer for their agent, until now, they had no way of doing so. To help with that, we recently added a new feature, which allows this sort of automation. The new feature allow developers of site extensions to have them add any configuration keys for by using XDT. To use it, all you have to do is have your code modify and add the keys to XDT using the following format: This could be places under either the Site root, or under Global, depending on your extensions’ design. Once the values are set via XDT, Azure will automatically pull these out and plug them as environment variables into the Worker Process, making them available for your extension to use. For more information about site extensions and XDT, visit this article.