Azure


I talked earlier about Cloud Services, and many vendors like Amazon, RackSpace, etc. are used more for consumer services and enterprises are generally weary of clouds – part of it being paranoia and might be baseless (because of coming up with a process of doing things differently) and a valid reason being security (authenticating with Active Directory) and not wanting to part with services that are not totally in a business’s control, because this could be a business’s core or its IP.
But, the result is that there big  savings, so it is worth looking into.
So, understand and address all the inhibitions to move to a cloud.

Now, the solutions for these are quite vendor-specific (Azure might have them, while Amazon may not), so I’ll mainly talk about Azure.
I mainly see 2 hurdles in using Azure viz.
1. Authentication
2. Proprietary (in-house) Services

In the case of authentication, IT cannot really move the entire Active Directory to the Cloud (and should not), which means that we need a third-party authentication with Azure (that’s what its called, because Azure does not authenticate you then) and our company.
That is, a user uses Azure, but has to authenticate first and this is done externally on- premises of the company (known as on-prem).
This is known as an on-prem/ off-prem solution in industry parlance.

For this, we can use WCF with the Azure Service Bus.
From the Azure website:

Think of the Service Bus as a way to communicate with Azure, and the communication happens between Azure and your company.
So, via this mechanism, Azure can callback into your company, which addresses both authentication and the services issue.

This also means that you need modular services that can be called by someone, which is anyway a good goal to have.

To inform your IT, Azure also provides the following features:

Virtual Machines— Allows you to move your virtual hard disks (VHDs) back and forth between on-premises and the cloud.
Existing workloads such as Microsoft SQL Server or Microsoft SharePoint can be migrated to the Cloud.
Use your own customized Windows Server or Linux images, or select from a gallery.

Windows Azure Virtual Network— Lets you provision and manage virtual private networks (VPNs) in Windows Azure, as well as securely extend on-premises networks into the cloud.
It provides control over network topology, including configuration of IP addresses, routing tables and security policies and uses the industry-standard IPSEC protocol to provide a secure connection between your corporate VPN gateway and Windows Azure.

Availability in New Countries— As of now (May 2013), availability is expanded to 48 new countries, including Russia, South Korea, Taiwan, Turkey, Egypt, South Africa, and Ukraine, making Windows Azure one of the most widely available cloud platforms in the industry with offerings in 89 countries and in 19 local currencies.

Here are details, and an example for you as a developer – http://www.windowsazure.com/en-us/develop/net/tutorials/hybrid-solution/

So, the Cloud is not only for consumer services, and with a little planning, Enterprises can use it as well.

I am building a website on Windows Azure (which is free, and a great offering) with Visual Studio 2010. The site is developed in MVC4 on .NET 4.0 and I am using Web Deploy in VS to publish this website from VS to Azure.

Things were smooth, but I suddenly started getting a problem with the deployment.
The error stated:
Web deployment task failed. (Could not complete the request to remote agent URL ‘https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=xxx.)

Could not complete the request to remote agent URL ‘https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=xxx’.
The request was aborted: The request was canceled.
COM object that has been separated from its underlying RCW cannot be used.

This is a very cryptic message and I did all kinds of things to resolve it.
Even searching for this was not too fruitful.

The answer was to restart Visual Studio and things started working again…like magic.

My hypothesis is that the connection was terminated somehow, and this was cached, so Web deploy kept giving this error. This is just a guess and I have n o idea how it works, but hopefully this post helps you from losing your mind..

I got slapped with an unexpectedly big bill for my Azure website, and the support team is actually very good and pointed me to a tool that warns you if you are getting charged, i.e. have any apps active in the cloud.

It’s a tool called Greybox (http://greybox.codeplex.com/) created by a guy called Mike (http://mvwood.com/blog/azure-greybox-1-0/)
It runs in the Windows taskbar as a grey box and turns blue to warn you, and has a small footprint.

Azure support even has a small jingle for it. Something like:

When it’s gray, it’s okay
When it’s blue, a bill is due

 

Hope it helps you from cancelling your flight to Hawaii because of an Azure bill. Thanks to Mike

There is a learning process to switching to SQL Azure from your local SQL Server database, and this was a painful but learning experience for me and this post will hopefully help you to get on that road.

Let’s assume you have created a SQL Azure database, which is pretty straight-forward, and want to now connect to it from a client.

Here’s what you will need…

Tools

You can connect to SQL Azure from within SQL Manager provided you have the SQL Server 2008 R2 edition. If you do not, you can connect a query I think from some posts I read but I’m not sure, so remember to upgrade to the R2 edition if possible, or you can  download the free R2 express edition.

Network settings

To connect to Azure, you will need changes at the server and the client.

At the server side in Azure, you will need to open the firewall to allow an IP range to allow connections from. Azure makes this very easy if configured from the client machine because when you Add new rule, it will display your IP and that makes it easier to specify a range.

In the end, you might end up with a few rules like this:

sql azure firewall

The client side could end up being one of the most frustrating aspects of using Azure. You need to have port 1433 to connect to SQL Azure. Period. There is no workaround that whatsoever. If you’re in a corporate network, this might be an issue. If you’re on a wireless network, this might be an issue because many public ones only have port 80 and a few others open.

You might get the following error if your port is not accessible.

sql azure error1

You might have to work with your corporate IT or ISP to open port 1433.

To check if your SQL Azure database is accessible from your machine, telnet into it. Here’s how: Depending on your Windows installation, you might have to install telnet. Go to Control Panel – Programs and Features. Select IIS and expand that node and check Telnet Client and install it. Go to a DOS prompt and type in telnet, and you will get a telnet prompt. To attempt to connect to your SQL Azure db, enter o xyz.database.windows.net 1433 and you should get a connecting prompt.
Something like this:

sql azure telnet

Otherwise, you’ll get a meaningful error message that you could troubleshoot.
When done, enter q to quit telnet.

Once you’re able to connect to your db in the cloud, it’s time to use it in your application.

Connection strings

To point your app to the SQL Azure db, it is just a matter of replacing your (local) connection string with an Azure connection string. This is made really convenient by the Azure folks because they provide a connection string in the online admin tool that you can just copy over.

Go to the Databases tab, select your database and click the Connection Strings button and you get a useful pop-up.

One gotcha if you make a mistake in putting in your string (which I did) is that you might get an error stating “Format of the initialization string does not conform to specification starting at index NN” This indicates it’s an XML problem and so double-check your string.

I think that covers the basics of connecting to your database in the cloud. Have fun!