Onur Yavuz
Onur Yavuz

Reputation: 101

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

Upvotes: 8

Views: 3964

Answers (3)

JJS
JJS

Reputation: 6658

Kudu has an API for this.

You get to Kudu like via App Services > Advanced Details > Go

https://{app-service-name}.scm.azurewebsites.net/ or https://{app-service-name}-{slot-name}.scm.azurewebsites.net/

The Url for the settings API is:

https://{app-service-name}.azurewebsites.net/api/settings or https://{app-service-name}-{slot-name}.scm.azurewebsites.net/

Upvotes: 0

knightpfhor
knightpfhor

Reputation: 9399

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.

Upvotes: 1

noopman
noopman

Reputation: 690

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*);

Upvotes: 2

Related Questions