Deploy Role with caching enabled to Windows Azure

I am currently setting up my first Azure project. I had a skeleton Solution with a Web Role (MVC 4) and a Worker Role.

To test the whole cycle I wanted to deploy early. We are using the visualstudio.com TFS, which can be coupled to Azure (or actually it’s the other way around) and a continuous deployment build template is available there (AzureContinuesDeployment.11.xaml).

I was experiencing unhealthy instances and timeouts (when the build script took more than one hour to execute – due to the deployment steps) after deployment. After some searching and experimenting I came to the following conclusion.

When you select the Caching option in the Role Properties, you MUST enter a valid Storage Account for deployment on Azure.

By default the configuration for that setting contains the well-known “UseDevelopmentStorage=true” value. While this is fine for running locally it absolutely will not work when deployed on Azure.

The Storage Account Name and Key can be found on the Azure Portal – Storage tab. Select a Storage account there from the list. Then in the App Bar (below) there is an option Manage Keys. There you can copy the relevant values. Note that I used the primary key. Not sure if it works if you use the Secondary key.

In hindsight it is logical and obvious, but it took me a good while to figure out that THAT was the problem.

Hope it helps.