Friday, February 21, 2014

Cloud is within your Reach -- Introduction of Microsoft Azure

First of all, I want to admit that I am not an Azure expert, all I know about Azure is very basic… but it is good enough to get me started with Azure, so can you!

When you do a search on the internet for “Azure”, more than likely to get this site https://www.windowsazure.com, if you are in the States you will be likely led to https://www.windowsazure.com/en-us/.
There is a big image read as <Try for Free> , click that link to enroll the free try offer, you get to use Azure for free for one month. After that you can use you MSDN Ultimate subscription to enroll to Azure or enroll into Azure as “pay-as-you go”. for MSDN Ultimate subscription account, you will have $200 credit per month to use, according to the regulation, MSDN resource is limited to “development and learning purpose". you are not supposed to use it for production purpose.


I have 3 accounts created with Azure, ( trial, MSDN and “pay-as-you-go” from my own pocket).  all I can say is “for your learning and development purpose, it will be free. ( considering $200 monthly credit );  If you want to use it for your own production usage like my case, it is “close to free”. if you want to use it for commercial use,  it has very strong competitive edge in term of cost .”

Azure offers lots of services, so far I only touched a few of them. for your reference, I list the ones I used below. Others like Virtual machine, SQL/Server, Mobile Service. one interesting one is Visual Studio Online, you get to use Visual Studio without having it be installed on your PC.  Specially on Virtual Machine, It provides pre- built  images includes Windows Serer 2012, Windows Server 2008 R2, SUSE Linus Enterprise, SQL/Server 2012 in Windows Server 2008 or Windows Server 2012.  Ubuntu Server 12, OpenLogic, Oracle Linux, Microsoft Dynamics on Windows Server 2012. Total number of pre-built images available is around 50 or so.  You also can install your own OS by providing your own ISO file. The regulation says you only can run Server OS in these Virtual Machines. if you want to run Windows 8.0 or 8.1 on these Visual machine, there are ways to make it work, but that is against Microsoft regulation.


1.    Active Directory
2.    Web site
3.    SQL database
4.    Storage
5.    Service bus

when you create first service, Azure gives you the AD service for authentication and Authorization purpose at no additional charge.

for each account you can create 5 web sites with one SQL/Server database (max size of 20MB) for free.  The total capacity for these web sites is 1GB. and up to 165MB outbound traffic daily included.

For additional database <100MB:  $5 a month, if the database size goes bigger, the price per GB goes lower,  when the DB size is >50GB, each additional GB cost only $1,   besides charges on database size, it also charge for all out bound traffic  but the first 5GB per month is free,  the charge rate goes from $0.12 per GB to $0.05 per GB  depends the traffic volume.

 For each additional web site, ( I have not used that yet, as 5 sites are  more than enough for me for play with).


1 CPU, 1.75GB RAM : $0.10 per month
2 CPUs, 3.5 GB RAM : $0.20 per month
4CPUs, 7GB RAM 0.40 per month

outbound traffic is charged from $0.10 per GB to $0.05 per GB

for  Service Bus:  the price is $0.01 per 10K messages and $0.10 for every 100 relay hours

for Data storage: the prices goes from $0.12 per GB to $0.037 per GB

I list all the price information here is to make a point that it is inexpensive. given the credit you have with your MSDN subscription. you basically use it for free. in my case, to host all services I need for my windows store app, it costs me less than $5 a month if any.  that was because I have 2 databases. If I merge them into one database, it would be free.

ok, enough about the pricing, let’s get into some technical stuff. in this article, I will touch on web site, database and Service bus.

 After the web site is created, you can specific .Net framework version, it supports both V3.5 and V4.5. you also can configure PHP version together with all kind settings you normally do with IIS if not more. On the portal site you have a link with the caption of “Download the publishing profile”, once you have that file, you can directly publish your site from within Visual Studio by loading the profile you just downloaded. with that, make a new release is as simple as a single button click.

Publish to web site Hosted by Azure


This is the screen shot I took after I loaded the publishing profile, all I need to do is click on <Next> <Next> and finally <Publish>. IDE will build my project in release mode and push the bits to the site in Azure. it is simpler than running MSI package like we do.

That is for Web site, let me  move on to SQL/Server database. About a few clicks, you will get your database created.  after the database been created, you can view the database connection strings for ADO.NET, ODBC, PHP and JDBC) . I copy the connection string for one of my database here to show you how it looks like:

 Server=tcp:jno757ecc5.database.windows.net,1433;Database=OAuth20;User ID=<your_user_id_here>@jno757ecc5;Password={your_password_here};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;

 with the Connection string, you can work on the database using SQL/Server Management Studio as you do with SQL/Server database on promise.

work with DB hosted by Azure using SSMS


This screen shot is when I try to connect to my DB server in Azure.  after login you can do almost anything you can do with the database on promise. you also can use your SSDT ( SQL Server Data Tool) project in your Visual Studio to the publish your database schema to your targeted DB in Azure. the only difference I found is that in Azure, you do not need to specific file group when you create database object.  when I move the database from my sql server in my home network to Azure, I need to remove “ON [PRIMARY]”

This is the screen shot of my publish database scream from with Visual Studio to Azure

Publish SSDT project to DB hosted in Azure


Now, let me move on to Service bus, the service bus I created is a notification hub.  it provides 2 end points, one is for the publisher to publish message to it, and one is for it subscribers to receive the message from  it.
Publisher end point

Subscriber Endpoint

all you need to do is plugging  these keys  in your publisher and subscriber respectively, it will start to work.

The first screen shot is a window desktop app I used to send the message.  the second screen shot is from My Surface 2 box where I installed the app subscribes to the notification bus.
Publisher sample

when notification reaches to client


all of Azure services have very good monitoring feature and alert feature. I put here a screen shot to show you how it looks like, to make the picture interesting, I hit the site a few times in the course of writing this article.

Monitoring your Service


As it is a POC kind of site, it is sleeping in most of time. but in case the site become busy and the response become slow. you want to define some alerts to get yourself notified. when that happens, you can easily scale up your site or your database.  scaling is done within Azure portal by adding more CPUs or adding more RAM. From application point of view, these changes does not affect the deployment process.it is still one single logical site or database. from free tier to shared tier  or from shared tier to standard tier, it is just one click of the mouse.
Scale your web site


 For Database, from 1GB max size for Web site to 150GB max size for LOB operation is just 2 clicks of mouse.  an empty Database is around 4MB in size, I got about 3000 rows of data in the DB, it is only 4.8MB. with that kind or rate, in the foreseeable future, I will not need to pay anything….

Scale your Database


let’s say you need to do data migration, testing, or host a dev site or dev database, but due to some reason, we do not have the space or box to do what we need to do, just keep in mind that Azure could be one of your options.  it is there for free, why not use it.

As always, please feel free to comment on this article or the future topic you would like to see me writing…

hope you enjoy reading it.



No comments:

Post a Comment