I just upgraded (via nuget) to the latest version of the Azure Configuration Manager (3.0.0):
https://www.nuget.org/packages/Microsoft.WindowsAzure.ConfigurationManager/3.0.0
Once I did that - and made a few namespace adjustments - it looks like it has stopped returning values for my Azure Worker Role configuration.
I'm retrieving a connection string value like this:
var storageCs = CloudConfigurationManager.GetSetting("Microsoft.Storage.ConnectionString");
My service definition file looks like this:
<?xml version="1.0"?>
<ServiceDefinition name="Payboard.Worker" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-06.2.4">
<WorkerRole name="Payboard.Worker.Events" vmsize="Small">
<ConfigurationSettings>
<Setting name="Microsoft.Storage.ConnectionString" />
<Setting name="PayboardEntities" />
<Setting name="cacheSystem" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" />
<Setting name="redisCacheConnectionString" />
</ConfigurationSettings>
<Imports>
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
</Imports>
<Startup priority="-2">
</Startup>
</WorkerRole>
</ServiceDefinition>
And my service configuration file like so (with sensitive information removed):
<?xml version="1.0"?>
<ServiceConfiguration serviceName="Payboard.Worker" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2014-06.2.4">
<Role name="Payboard.Worker.Events">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.Storage.ConnectionString" value="UseDevelopmentStorage=true" />
<Setting name="PayboardEntities" value="(standard connection string stuff)" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="ken" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="(encrypted password)" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2015-06-19T23:59:59.0000000-07:00" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
<Setting name="cacheSystem" value="simple" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" value="1" />
<Setting name="redisCacheConnectionString" value="(redis connection string)" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="(blah)" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
All of this worked correctly under 2.0.3, and indeed, works correctly if I revert back to 2.0.3. But any call to CloudConfigurationManager.GetSetting()
returns null under 3.0.
I haven't found any documentation about what's supposedly changed under 3.0. Anybody have any suggestions? Is this just a bug of some sort? (Obviously I'm sticking at 2.x for now - no compelling reason to get to 3.0 - but I like sticking with the latest versions of stuff as a general rule.)
This is because a class called AzureApplicationSettings that loads the ServiceRuntime is looking for an assembly called Microsoft.Azure.ServiceRuntime (see below). The current version in the 2.5 sdk still has the old name (Microsoft.WindowsAzure). This assembly (at least, in the past) has not been provided through nuget but instead ships with the SDK. There is a big Azure announcement next week (3/24/15) so possibly we'll get a new SDK at that time. The various Azure groups have so far been working out the kinks of exactly how to push time coordinated releases that are interdependent on each other.
private readonly string[] knownAssemblyNames = new string[]
{
"Microsoft.Azure.ServiceRuntime, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL"
}