Configure Azure Cache From Cloud Config in PAAS

I’ve recently been working with the Azure cache  client which, by default, is configured by storing the details in your app.config or web.config.

Now this is great if you’re in the traditional world but for Azure Platform as a service solutions Cloud Configuration is key. It allows you to change settings easily across multiple machines without having to jump into web.configs or redeploy etc.

I wrote the little method below to help me to do this as in my testing I was jumping between a couple of different cache’s regularly.

You can then use the CloudConfigurationManager to retreive the info needed then call into the method to start using the cache:

CloudConfigurationManager.GetSetting("CacheDiscoryUrl")
CloudConfigurationManager.GetSetting("Token")

You may want to alter to use something other than the “GetDefaultCache” method but hopefully a good starting point.

[This method was tested in a limited way, double check it makes sense for you before going nuts and putting it into prod!]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: