Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get all configuration settings from Azure Config file?

I need to get all configuration settings (current role or all roles not matter) from Azure cscfg file. I want to do this because i dont want to get all values one by one via RoleEnvironment.GetConfigurationSettingValue(key) method.

Is there any way to do this?

Regards

like image 783
Onur Yavuz Avatar asked Jan 03 '12 10:01

Onur Yavuz


2 Answers

The short answer is 'no' the RoleEnvironment does not support getting all the configuration setting values.

A slightly longer answer is that getting configuration settings from the role environment in the current implementation is done through a call to native code. The separation of Windows Azure Application from Windows Azure Configuration and the ability to swap settings on a running application is at the root of this somehow. This is done inside of msshrtmi.dll (which should mean something like Microsoft Shared Runtime Managed Interop). This is the only reference Microsoft.WindowsAzure.ServiceRuntime.dll has apart from standard references to .NET.

Here is the method call to native code (I have not gone further than this):

[MethodImpl(MethodImplOptions.Unmanaged, MethodCodeType=MethodCodeType.Native), SuppressUnmanagedCodeSecurity, DllImport("", EntryPoint="", CallingConvention=CallingConvention.StdCall, SetLastError=true)] internal static extern unsafe int modopt(IsLong) modopt(CallConvStdcall) RdGetApplicationConfigurationSetting(ushort modopt(IsConst), ushort*);

like image 197
noopman Avatar answered Nov 15 '22 06:11

noopman


It might seem like a slightly round-about way of doing it, but if you want to get the configurations for all the roles in a deployment you can use the management api.

like image 41
knightpfhor Avatar answered Nov 15 '22 08:11

knightpfhor