Michael Collier is a Windows Azure MVP and serves as a National Architect for Neudesic, a Microsoft SI partner that specializes in Windows Azure. He has nearly 11 years of experience building Microsoft-based applications for a wide range of clients. Michael spends his days serving as a developer or architect – helping clients succeed with the Microsoft development platform. He also enjoys speaking about Windows Azure at local user groups, as well as regional and national conferences. Michael is also the founder of the Central Ohio Cloud Computing User Group in Columbus, OH. You can follow Michael on Twitter at www.twitter.com/MichaelCollier and on his blog at www.MichaelSCollier.com. Michael has posted 16 posts at DZone. You can read more from them at their website. View Full User Profile

Configuring Windows Azure to Store Diagnostic Information

04.05.2012
| 1027 views |
  • submit to reddit

I was recently deploying a Windows Azure project where I used a different Windows Azure storage account for diagnostic data than for application data.  After publishing the project to Windows Azure I noticed the diagnostic data wasn’t showing up as expected – there was nothing in the storage account I set up to collect diagnostic data.  I checked the storage account for the application, and the diagnostic data was being collected there.

Well, that’s odd.  I checked the value of the ‘Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString’ connection string, and sure enough it was set to the storage account for the application, not the account I set for diagnostic data.

I had set the diagnostic connection string to use the ’findabathroomdiag’ storage account.

<Role name="FindABathroom.Web">
<Instances count="2" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=findabathroomdiag;AccountKey=b" />
<Setting name="DataConnectionString" value="DefaultEndpointsProtocol=https;AccountName=findabathroom;AccountKey=a"/>
  </ConfigurationSettings>
</Role>

I would then publish the project using the publishing wizard in Visual Studio.  In this wizard I would set the storage account to publish to ‘findabathroom’, the storage account for the application.

 

Looking at the ServiceConfiguration.cscfg file in the Windows Azure management portal I noticed the ‘Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString’ connection string was set to use ‘findabathroom’, and not ‘findabathroomdiag’ as I had expected.

What?  Somebody’s playing tricks on me!

No tricks.  I had forgotten about a change made to the Windows Azure tools for Visual Studio.  If you open up the properties for your Windows Azure role, go to the Configuration tab.  In the Diagnostics area you’ll find the “Use publish storage account as connection string when you publish to Windows Azure” check box.  This option is checked by default!

This little check box setting will cause Visual Studio to change your diagnostics connection string to match the connection string used during publishing of the application.

If you don’t want Visual Studio to change your diagnostics connection string, then be sure to uncheck that box!

Published at DZone with permission of its author, Michael Collier. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)