Azure, Sql User invalid from Azure Website

Problem

I was faced with a problem this morning that took me a good 30 minutes to figure out..

I had created a website and associated SQL database. However I changed said database as part of some development work. The problem was that even though my publish profile was overriding the Release Connection String with my new database it was getting ignored!

image

 

I knew that the connection string I was supplying was correct as I could log in with Visual Studio and SSMS.

Cause:

The reason is that the website had already an connection string (under the Configure tab) and this was taking preference. The reason this is here is that one does not have to store the Azure connection string in the publish profile which is quite nice, same goes for a lot of other Azure features.

image

 

Solution

I removed same and then it works. (Fixing it is also another option but this code is in a private git repository so it’s not a concern for me just now).

Uploading a Blob to Azure container

image

 

In the picture above you see a storage account in Azure, in the storage account we have an ecbfx (European Central Bank FX Rates) container. Now let’s see how to upload some data to this container using a C# console application.

NUGET

Given we are going to work with C# the best option is to use the .NET library, this can be retrieved from NuGet

image

 

Code

image

The code above connects to the pre-created container, notice that my container has built in Geo Redundancy (primary storage in Dublin, secondary in the Amsterdam) so after running there will be 6 copies of this blob, 3 in Dublin and 3 in Amsterdam, this is the storage package I’ve chosen.

image

 

View Blob

The easiest way to view the newly uploaded blob is to use the Windows Azure server explorer in Visual Studio, it’s the easiest way of getting the connection string to the storage account also.

image

In the next post I’m going to show you how react to someone uploading a Blob with an automatic trigger.