4

In Azure SDK 2.5 the storage account is set in the wadcfgx of the role like this :

<PrivateConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<StorageAccount name="myDiagnosticAccount" endpoint="https://core.windows.net/" />

The problem is that I want to have separate diagnostics accounts for staging and production. Like this:

For staging

<PrivateConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<StorageAccount name="myProductionDiagStorageAccount" endpoint="https://core.windows.net/" />
</PrivateConfig>

and for production

<PrivateConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<StorageAccount name="myStageDiagStorageAccount" endpoint="https://core.windows.net/" />
</PrivateConfig>

But I do not see any possible way to do this since this config is per role and not per service configuration. In the previous SDK I used to set two different diagnostics connection string - “Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString” - and everything worked fine.

How can I achieve this now in SDK 2.5?

Ognyan Dimitrov
  • 6,026
  • 1
  • 48
  • 70

1 Answers1

4

You're correct. With SDK 2.5, it is not possible to define different storage accounts for different deployment environments.

One possibility would be to keep two separate diagnostics configuration files (one for staging & other for production). You would need to keep diagnostics disabled during deployment and once the code is deployed, you can enable the diagnostics using Set-AzureServiceDiagnosticsExtension Cmdlet.

In fact, it seems like recommended approach based on this blog post: http://blogs.msdn.com/b/kwill/archive/2014/12/02/windows-azure-diagnostics-upgrading-from-azure-sdk-2-4-to-azure-sdk-2-5.aspx (See the section titled Enabling diagnostics extension through PowerShell). From the blog post:

Since Azure SDK 2.5 uses the extension model the diagnostics extension, the configuration and the connection string to the diagnostic storage are no longer part of the deployment package and cscfg. All the diagnostics configuration is contained within the wadcfgx. The advantage with this approach is that diagnostics agent and settings are decoupled from the project and can be dynamically enabled and updated even after your application is deployed.

Due to this change some existing workflows need to be rethought – instead of configuring the diagnostics as part of the application that gets deployed to each environment you can first deploy the application to the environment and then apply the diagnostics configuration for it. When you publish the application from Visual Studio this process is done automatically for you. However if you were deploying your application outside of VS using PowerShell then you have to install the extension separately through PowerShell.

UPDATE - 26-May-2015

SDK 2.6 actually supports different storage accounts for different deployment environments. From the release notes:

The Diagnostics storage account can now be specified in the service configuration (.cscfg) file making it easier to use different diagnostics storage accounts for different environments.

If you are already using SDK 2.5, I would recommend upgrading it to SDK 2.6.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241