Building Applications for Windows Azure



Building your application or service for the cloud lets you focus on building the right software using the skills you already have while someone else handles the details of infrastructure, hardware, and service management.


Windows Azure, Microsoft’s platform for cloud-based applications, has been available in CTP form for the past year, and Visual Studio has supported the development of Windows Azure applications since the very first CTP release through an add-in known as Windows Azure Tools.  This add-in is available for VS 2008 via the Web Platform Installer.  Visual Studio 2010 Beta 2 has all the features you need to code, debug, and deploy your cloud service.


Windows Azure allows you to build robust production-quality applications that can be deployed, maintained and supported, and Windows Azure is accompanied by the November 2009 release of the add-in for Visual Studio, which lets you take advantage of the platform in the most efficient way.


Getting Started


Developing for Windows Azure is very similar to developing an ASP.NET application for IIS and Windows Server.  However, there are some differences, and Visual Studio makes it much easier to navigate those differences.


One of the first things that you’ll notice when developing for the cloud with Visual Studio is the introduction of a top-level Cloud tab on the Get Started section of the redesigned Start Page.  This page offers up a wealth of resources that cover creating your first cloud application and contain resources that will continue to be useful again and again, such as links to the community areas for Windows Azure and regular updates about new features and services offered.


Start Page


You can create your own cloud service using the Cloud Service project template that is part of the Visual Studio 2010 (and Visual Web Developer 2010 Express) installation.  Click on the File | New | Project… menu, browse to either  the Visual Basic and Visual C# nodes, and select the Cloud Service node that contains a project template called “Enable Windows Azure Tools”.


New Project


This template, new in Beta 2, makes it very easy to get the latest tools for developing Windows Azure services.  After creating the project, the template will direct you to download the Windows Azure Tools in order to continue.  This guarantees that you’ll be using the latest version of the tools that support the latest version of Windows Azure.


Download Tools


After installing the tools, the New Project dialog will provide an option to create a Windows Azure Cloud Service.  Visual Studio now supports creating, editing, building, debugging and deploying these services.


To create a new project, use the File | New | Project… menu item to bring up the New Project Dialog and select “Windows Azure Cloud Service” under the Visual Basic or Visual C# nodes.  This will bring up a dialog that can be used to add Windows Azure Role projects to your cloud service.


New Cloud Service Project


One of the unique aspects of Windows Azure is the ability to individually scale work across any number of instances.  Windows Azure segments “components” into Roles.  A Role is an individually scalable component running in the cloud where each instance of a Role corresponds to a virtual machine instance.  There are two types of Roles:



  • Web Role – a web application running on IIS that is accessible via an HTTP and/or HTTPS endpoint.

  • Worker Role – a background processing application that runs arbitrary .NET code. It also has the ability to expose internet-facing and internal endpoints.

There are multiple template options for each type of Role you wish to add.  For example, ASP.NET Web applications, ASP.NET MVC 2 and WCF Service Application templates are available to create a Web Role.  Add one or more Roles to your cloud service and click OK to create the solution and projects.


Roles


After you’ve created the service, your solution has several projects in it.  One of these is the Cloud Service project which contains all of the configuration information needed by Windows Azure in order to run your service and also provides the ability to add or remove Roles after project creation.


Right-clicking on the role associations under the Roles node and selecting “Properties…” will bring up a configuration page that makes it easy to set up each Role.


Role configuration


Getting It Just Right


One of the key benefits of using Visual Studio 2010 for developing Windows Azure Cloud Services is the simulation environment on which you can test, debug, and run your service completely locally without requiring a Windows Azure Account.  This simulation includes the development fabric, which will run your cloud service the same way it runs in the cloud, and the development storage, which runs the Windows Azure storage on your machine.  With the development fabric and storage, you can develop, test, and refine your cloud services offline.


When running in the development fabric you can use all of Visual Studio’s powerful debugging features, including seamless debugging across different roles and role instances.  Below, a debugging session allows you to step through the execution of a web role.


Debug Azure Projects


Deploying to the Cloud


Once you are ready to move your application to the cloud, Visual Studio provides a publish step that packages your cloud service into a deployable Windows Azure format, then you can deploy your cloud service using the Windows Azure Developer Portal.


To learn more about all of this, please visit the Cloudy in Seattle and Cloud Tools blogs.


Namaste!

Comments (16)

  1. really awesome and good….and cloud service is really going to rule the world… 🙂

  2. Joe White says:

    FYI, my corporate IT department blocks access to livefilestore, citing security risks. So when I try to read your blog from work, the screenshots are all missing.

    I don’t know how big a hassle it would be for you to put your images on your blog instead of a separate file-sharing site, like some other MSDN bloggers do, but it’d make it a lot easier for me to follow your posts.

  3. stimul8d.com says:

    Ah,…damn it!  It looks really good.  Guess that’s another technology on the to-do list.

  4. prasad says:

    Hi,

    Thanks for the article.

    Looks like  Cloud computing would be the buzz word in the coming years…

    But what about the security?

    Is it a secured way of transporting/channeling the sensitive data to the data centers?

     Or

    Do we need to build wrappers on top of this cloud services using WCF ??

    It would be great, if you can spend few minutes to write something about the authentication/authorization mechanism embedded in Cloud computing.

  5. I think VS 2010 itself provides with the tools for cloud computing…so no need of any WCF wrapper as such…

    Rishi

  6. @prasad – Windows Azure provides https endpoints to Windows Azure storage as well as to the developer portal to ensure that data transfers are protected.

  7. Basant Singh says:

    Azure will rock! Cloud computing is the buzz for coming 2/3 years. I am waiting to give it a try…

  8. Colin says:

    @Prasad – you should look into Windows Identity Foundation.

  9. Colin says:

    For more help on deploying your first Azure app (with no app or tools required), see my post that was used by Microsoft at Techdays in Canada – http://tinyurl.com/azuredeployguide .

  10. I’m glad that Windows Azure seems to be very similar to developing an ASP.NET, is Visual Studio updated regularly enough for it to be a definative source of diffences between the two?

  11. phuff says:

    telephone answering service:

    The Azure Web Role uses ASP.NET, so Web Roles will be easy to build for ASP.NET developers.  In fact, you can move your existing ASP.NET website to Azure easily as long as you haven’t written custom code that accesses the local storage of the server or interacts with the OS in other similar ways.  Visual Studio, with Windows Azure Tools, will continue to provide templates and features to make it easy to build Azure applications with Web and Worker roles.

    Windows Azure Tools, the separate add-on for VS that enables Azure development, updates more often than VS does to ensure developers can build great Azure apps on VS.  You can download the current version from the links provided in the post above.

    Polita Paulus

    Microsoft

  12. Prasad says:

    Hello Soma,

    Recently, I got an opportunity to attend your Azure team's presentation by Ramaprasanna in my company here in Bangalore.

    I would like to gather more knowledge on Azure platform and apply it in my work.Also how can I showcase the capabilities of Azure env. instead of plain vanilla  asp.net web applns. and encouraging them to migrate it into private cloud.

    How can I approach my client to implement private Cloud in their day to day operations?

    thnx  

    Prasad

  13. phuff says:

    Prasad:

    I'm happy to hear you've been learning about Azure and are excited to make use of it.  Please contact Rajinish, one of our developer evangelists in your area, at (krmenon at microsoft dot com) for help in moving your client to Azure.

    Polita Paulus

    Microsoft

  14. <a href="http://www.websitemarketingservicesuk.co.uk">website marketing services</a> says:

    Thanks Somasegar for a great article. It will help me with my studies.

  15. R.Sridhar. chennai says:

    Hi Soma, Sridhar from Maptech chennai.

    I have my client M/s Adyar Anand Bhavan runs their Restaurant ERP on VB6 and MS SQL server (10 million rows every year) wants to migrate from VB6 to Cloud technology. Can we migrate from VB6 to Azure , will it involve multi step approach (migrating from vb6 to vb.net then to Azure). Pls advise.

    Regards

    Sridhar

    919444025282

  16. Somasegar says:

    @R.Sridhar. –  For your VB6 application, you should consider looking at Azure Infrastructure Services (http://www.windowsazure.com/…/infrastructure), to move your existing architecture to the cloud.  From there, you can consider whether a move to VB.NET and Azure Web Sites would provide additional benefits for your application.