Azure : HOWTO/BEST-Practice : Publish WebApp with Webjob using blobs Q's to multiple destinations?

140 views Asked by At

I have a webapp that I publish from VS. I have 3 publishing profiles (Test, Demo and Production). Each targets a different server on Azure, with it's own SQl behind it. I added a webjob using Queue's and Blob-storage. Again for test, demo and production I create 3 different storage accounts.

On publishing time to set different connection strings for the SQL-connection is straightforward. Just change the in the publishing wizard.

But what about the connection string for the storage account ? How to have them changed on publishing time to the correct environment ?

1

There are 1 answers

0
Enrico Tirotta On BEST ANSWER

If i understand your question : set key in your App webconfig with dummy values

<appSettings>
     <add key="BLOBAzure1" value="Check Azure" />
</appSettings>

Get connection string for blob at runtime with something like this:

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("BLOBAzure1"));

Inside Azure Panel go to your Web app properties and set REAL keys inside APP SETTING. Redeploy projects and all work fine.

Read this article if you have any doubts Windows Azure Web Sites: How Application Strings and Connection Strings Work