Export (0) Print
Expand All

CloudConfigurationManager Class

Static class to access Windows Azure configuration settings.

Namespace: Microsoft.WindowsAzure
Assembly: Microsoft.WindowsAzure.Configuration (in Microsoft.WindowsAzure.Configuration.dll)

Public NotInheritable Class CloudConfigurationManager

The following example retrieves the value of a configuration setting named StorageConnectionString from the appropriate configuration store.

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(

The CloudConfigurationManager class reads configuration settings from the appropriate configuration store for the platform on which the application is running.

Windows Azure cloud services (web roles and worker roles) and Windows Azure websites store configuration settings in the ServiceConfiguration.cscfg file, which is unique to applications running in Windows Azure. A .NET application running in an environment outside of Windows Azure usually stores configuration settings in a web.config or app.config file. The CloudConfigurationManager class enables you to read from the appropriate configuration file regardless of the environment in which your code is running.

If you are currently calling Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue from within a web or worker role to retrieve configuration settings, you can modify your code to call GetSetting instead. For new projects, using GetSetting is recommended.

Similarly, if your code is currently reading from an app.config or web.config file using AppSettings or a similar API, you can modify your code to use GetSetting.

Note that in order to use CloudConfigurationManager to read from an app.config file, you must specify the configuration settings in the appSettings tag, as in the following example, where StorageConnectionString is the configuration setting to read:

<?xml version="1.0" encoding="utf-8" ?>
    <add key="StorageConnectionString" value="DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey"/>

Only configuration settings within the appSettings tag can be read by CloudConfigurationManager. If your configuration settings are within a different tag, calling GetSetting will return Null.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

Target Platforms

Community Additions

© 2015 Microsoft