Custom configuration section in Azure Cloud Service

1k Views Asked by At

Is it possible to a custom configuration section inside of an Azure Cloud Service Configuration, the same way you would in a regular ASP.NET website?

I.e in a regular ASP.NET site your Web.Config would have something like this:

<configuration>
  <configSections>
     <section name="myCustomConfig" type="MyNamespace.MyType" />
  </configSections>
  <myCustomConfig someProperty="someValue" />
</configuration>

How is this done in Cloud Services and shared across multiple different roles?

1

There are 1 best solutions below

0
On

At this time I do not believe this is possible. There is a post for it on user voice you can vote up: http://www.mygreatwindowsazureidea.com/forums/169386-cloud-services-web-and-worker-role-/suggestions/459944-enable-custom-configuration-sections-in-csdef-cscf.

As a way around this you could put configuration into a file that is stored in BLOB storage. On start up, or when it is needed, all instances could then go pull the file to get the configuration. To deal with changes to the configuration you could either have the instances pulling the configuration from time to time as a refresher, or you could tap into the environment changed event in RoleEntryPoint that is used to detect changes to the Service Configuration. Add a setting to the service configuration that is a version number of your shared config file or something, just anything that could be modified to trigger the RoleEnvironment.Changing event.