Windows Azure Training Series: Creating Your First Azure Project

This is another in a series of articles on getting started with Windows Azure.  This post will walk you through creating a Windows Azure application. It assumes that you have Visual Web Developer 2010 Express already installed (or Visual Studio 2010), along with the Azure Tools for Visual Studio. If you don’t, see my previous post Windows Azure Training Series:  Setting up a Development Environment for Free.

You’ll create a simple ASP.NET application that just squares a number.

Creating a Windows Azure Project in Visual Studio

Start Visual Web Developer 2010 Express (or Visual Studio), and then select the File | New Project menu. The New Project dialog will open. Expand Visual C#, in the Installed Templates tree view, and then click on the Cloud branch. From the list of templates on the right, select Windows Azure Project.

Visual Basic would work just as well, but the code later on is in C#.

Give your project the name “SquareANumberAzureProject”. Also, set a location where you want to save the project. Then, click the OK button. See the screen shot below.

The New Windows Azure Project dialog will open. Select ASP.NET Web Role from the list on the left, and click on the right arrow to move it to the list on the right. Hover over the Web Role and a pencil icon will appear. Click on that icon, then change the name of the role to “SquareANumber.Web”. When done, click OK. See the screenshot below.

Editing an Azure Web Role in Visual Studio

Your Windows Azure project will be created, and will open in Visual Studio. You should see the Solution Explorer window on the right.

Two projects were created, an ASP.NET Web project and an Azure service project. The Azure Web application is edited the same way as any other ASP.NET application. The Azure service project is used to configure the application, and to create a deployment package when you are ready to upload the application to the cloud (we’ll cover that in a later post).

Let’s make the application do something. In Solution Explorer, double-click on the file Default.aspx to open it in the code editor. At the bottom of the code editor, click the Design button to see the graphical editor. Delete the existing content, and then drag a TextBox, Button and Label onto the Web page from the toolbox. The page should look similar to the screenshot below.

You need to write some code to take the number entered in the text box, square it, and put the answer in the label. Double-click on the button, and an event handler will be created. The code below will work well enough for this program.

Running your Azure Project using the Windows Azure Platform Emulator

From the Visual Web Developer toolbar, click the green run button, or select the Debug | Start Debugging menu. You’ll likely get the error shown below.

Save your work and then close Visual Web Developer. To run Visual Web Developer with elevated privileges, right-click on its icon in the Start menu and select Run as administrator. See the screenshot below.

Once Visual Web Developer starts open your project and try to run it again. It will take a little while, but your program should start and you will be able to square some numbers! The reason it takes a little while for the program to start, is because it is running using your development machine’s local Windows Azure Platform Emulator. You should be able to see the emulator’s icon in the Windows taskbar on the lower right side of your screen. It’s the one that looks like a blue Windows logo, as shown below.

Right-click on the Azure emulator’s icon, and then select Show Compute Emulator UI. This will open a form that displays the Azure services running on your machine, and their status. See the screen shot below.


Visual Studio and the Azure tools make creating Windows Azure Web applications easy. The Windows Azure Platform Emulator makes it easy to test Azure applications on your local development machine. In a later post, I’ll cover deploying this application to the cloud.

To learn more about Windows Azure, come to Learning Tree course 2602:  Windows Azure Platform Introduction: Programming Cloud-Based Applications.

Doug Rehnstrom

As cloud computing continues to make information technology headlines, vendors are aggressively promoting the many benefits it can provide organizations.  Our White Paper, Cloud Computing Promises: Fact of Fiction, addresses the claims and questions that are often raised in relation to cloud computing and provides a clear view of what the cloud can—and can’t—deliver in reality.

Type to search

Do you mean "" ?

Sorry, no results were found for your query.

Please check your spelling and try your search again.