Getting Started with Windows Azure: Part 2 - Creating a Windows Azure Hello World Application

Follow along as I learn all about Windows Azure.

Part 0 – Where do I go to get started?
Part 1 - Setting up your development environment
Part 2 - Creating a Windows Azure Hello World Application <<<< YOU ARE HERE

Below are the steps to create a simple Windows Azure Hello World application.  These steps assume that you have installed the Windows Azure Tools for Visual Studio.  See Part 1 - Setting up your development environment for more information on setting up your development environment.

Open Visual Studio 2008 and choose New Project.  Then expand the language of your choice and click on the “Cloud” category to find the Windows Azure Cloud Service project type.

image

 

Select the Windows Azure Cloud Service project type and then you will be presented with the Role selection dialog.  Choose the ASP.NET Web Role and move it to the right-hand frame.  You can edit the name of the role by clicking on the edit (pencil) icon for that role.

image

 

You will then have Visual Studio projects like the following:

image

Modify the Default.aspx page to include your “Hello World” text or anything else you would like and then hit F5 to test.

After Windows Azure finishes initializing the Development Storage, you will be presented with your Hello World page running on your local machine:

image 

At this point you are ready to deploy to the cloud but first you need to sign up for the service.  I will move on with how to sign up and create the Windows Azure Portal Account and then come back to publishing and deploying your Hello World project later….

Signing up for the Windows Azure Service

Next up is to sign up for the Windows Azure Service through Microsoft Online Services.  Signing up for a Windows Azure account can be a little confusing since you don’t sign up for Windows Azure directly but sign up with Microsoft Online Services which manages all of your subscriptions to the Microsoft Online Services (Azure is one of them; there also is the hosted Exchange and SharePoint which you can sign up for too).

You can see the various Windows Azure offers from this page and here is a Windows Azure Comparison chart which shows that there is a free offer called “Introductory Special”.  The Introductory Special offer says it lasts only until July so I guess at that point Microsoft Online Services will start charging your credit card for any services that are in use.

WARNING: The introductory offer only includes 25 hours of compute time.  You can easily burn through that by just leaving your deployment running (faster if you have both a staging and production deployment running).  Make sure you DELETE (not suspend; you must DELETE) your hosted service deployment (see below) when you have finished with this tutorial.

image

Clicking on the Buy button takes me to the Microsoft Online Services customer portal where you can sign in with your Windows Live account and sign up for the Windows Azure Service.  NOTE: Signing up on the Microsoft Online Services site is a multi-step process where you first create your account, then checkout with the Windows Azure Introductory Special in your shopping cart, activate your service, and finally specify the service administrator. 

Here is the Service Activation Screen where I have specified the project name as “AzureHelloWorld”.  This project name will be the project that is created in the Windows Azure Portal later on (what’s up with those purple borders around everything?!?).

image

Now you will have a subscription to Windows Azure and after a little bit the Microsoft Online Services Customer Portal will show that the Service is Active:

image

Now you can go to the Windows Azure Portal (http://windows.azure.com) and sign in with the same Windows Live account that you used to sign up for the subscription at Microsoft Online Services.

Now you will see the Windows Azure Portal home page with a single project named from when you activated the service (in my case, AzureHelloWorld).

image

Select this project and choose New Service which is located to the right and just above the project name:image

Choose the Hosted Services from the two Windows Azure services that are presented:

image

Then name the service:

image 

Then choose a url for your service and also the region where it will be running:

image

Clicking Next will get you to the Deployment page:

image

Now you are at the point where you can deploy your Hello World project that you created earlier, but first you have to use Visual Studio to Publish it.

Return to your Hello World Visual Studio Windows Azure project and right click on the HelloWorld Azure Project and click “Publish…”:

image

This will create the deployment package and the configuration package (and open Windows Explorer to their location too):

image

A new browser will be opened and you will be taken to the Windows Azure Portal but you can close that and return to the previous window where the Deploy cube was showing:

image

Click that “Deploy…” button and browse to the application package (*.cspkg) and configuration settings (*.cscfg) and then give a name for this deployment:

image

and finally click the Deploy button.  Your files will begin copying:

image

And then you will see your package getting deployed:

image

Then once it is deployed, you can click Run and your application will begin initializing:

image

This took a while for me but eventually it finished (I actually went to lunch so I am not sure how long it took but it was greater than 10 minutes).

image

And now when you browse to the cloudapp.net web site url on your console you will get your Windows Azure Hello World:

image

image

And there you have it… a successfully created and deployed (and running) Windows Azure Hello World application from beginning to end. 

DON'T FORGET: Make sure your DELETE your hosted service deployment when you are finished trying out Windows Azure.  The introductory offer only includes 25 hours of compute time.  You can easily burn through that by just leaving your deployment running (faster if you have both a staging and production deployment running).  And only suspended it does not stop the hours from accumulating.  You will need to DELETE the hosted service deployment to stop the compute hours from accumulating.



11 Comments

  • I think you should have a very strong warning on this tutorial that basically your compute hours start accruing the minute you deploy your application and for some reason there are 48 compute hours per day per deployment. So you only have 12.5 hours to leave your app up on azure before you start getting billed $5.76 a day or $172.80 a month. If you use all 20 of your allowed deployments, it will run you about $3500 a month. Microsoft is completely unsympothetic to any ignorance of this policy.

  • ...and that is even with 0 bandwidth usage!

  • Hey Eric,
    Thank you very much! I completely missed that point too. I just figured free meant, well, free and not only 25 hours. I went through 33 hours so my bill won't be that bad but you sure saved me a ton of money. I will update this post will a big red warning too.
    Thanks,
    -Jeff

  • That's what I thought free meant too! ;) Glad I could help and hopefully it will help many others. Wish I had been as lucky, but it was a good learning experience. It could have been so much worse though.

    BTW, nicely written article.

  • The point Eric brought up is downright scary!

    1. This article states: "DON'T FORGET: Make sure your SUSPEND your deployment". How is that done? I need to know!

    2. Are there any tools available, other than the bill from Microsoft, that indicate Cloud bandwidth and storage usage?

    I'm afraid for many folks, the "Cloud" will be like their first $600 cell phone bill! "How did that hapen? I just talked a few hours over the plan limit".. Surprise!

  • Upon reaching the step - Publish, Where to publish is not mentioned.

  • Hi Sreeraj,
    Look in your projects bin/debug folder. The Publish folder will be in there.
    -Jeff

  • To the best of my knowledge, you have to delete the deployment and not only suspend it to make sure you are not charged. If I am wrong, someone please correct me.

    -Dan

  • Hi Dan,
    Yes, you are correct; you must DELETE your hosted service deployment to stop compute hours from accumulating. Thanks for the comment. I reviewed the post above and updated to indicate that a DELETE is necessary.
    Thanks,
    -Jeff

  • The costs seem really crazy, or have I misunderstood something? If I wanted to build my "simple portfolio website" and deploy it to Azure, your saying it is going to cost me $172.80 per month?

  • Hi Ben,
    Take a look at http://www.microsoft.com/windowsazure/offers/default.aspx for the latest prices. Right now there is an offer for the first 25 hours free (above 25 hours is $0.12/hour for the smallest size). Using the rates for a small instance, the total monthly amount is about $85/month (not including storage space or bandwidth). So while it is not the $172 you mention, it is still quite expensive to host a "simple portfolio website". But also you have to keep in mind the benefits of Windows Azure (easily able to scale up, deployment advantages, etc.) which you would not get if you used a low end hosting company.
    -Jeff

Comments have been disabled for this content.