Microsoft & .NET.NETIs Azure the New Silver Lining?

Is Azure the New Silver Lining? content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Microsoft first announced Windows Azure to the developer audience at the Professional Developer’s Conference in Los Angeles in November, 2008. Windows Azure is a set of services that is available for users, IT administrators, and developers. What’s interesting about Azure is that it is cloud based. But, unlike competing solutions from other vendors, Microsoft has taken care to design Azure to be more than just a hosted application platform “somewhere out there.”

But, if you are happy developing applications for the Windows platform today, why should you spend your time learning about a high-flying technique such as cloud computing? And, what does all this have to do with clouds in the sky?

As you will learn later on, cloud computing can have many benefits. However, it should be mentioned right away that cloud computing or Windows Azure won’t be replacing traditional Windows development anytime soon. That is, cloud computing should be thought of as a complementary technology for developing and running your applications.

One of the biggest benefits of cloud-based computing is that the end user doesn’t necessarily need to maintain a server farm to run their applications. It is relatively easy to build a small application and serve it to five or ten users, but things get considerably more difficult if you multiply the number of users by one hundred or one thousand. In a cloud, you have more or less endless computing power (at least while your wallet is thick enough). In Azure, supporting more users merely requires changing a configuration setting.

Other obvious benefits of cloud-based computing is the possibility to access a common storage from everywhere. For instance, setting up a local SQL Server installation is relatively straightforward, but if you want to access this database from outside the firewall, security and access control quickly are big issues. Cloud computing can ease this pain.

Windows Azure: The Big Picture

If the previously mentioned benefits seem interesting to you, why not learn a bit about Windows Azure? When studying this new Microsoft offering, you should understand the big picture first. Firstly, Windows Azure is not ready yet, and is not technically complete. Furthermore, although current preview usage is free, there will be costs involved in using the computing resources provided by Azure. How much these costs are, you can’t get the answer from Microsoft just yet. It will take some time for the pricing to finalize.

Technically speaking, Azure’s architecture can be thought of as consisting currently of four different services. These are:

  • Windows Azure itself, the “operating system” services
  • .NET Services
  • SQL Data Services (SDS)
  • Live Services

Each of these services has a different purpose, and must be used and programmed in different ways (see Figure 1). The first service, Windows Azure, can be thought of as the base platform for other services. Azure differs from other hosted services in that you cannot upload your ready-made executable and run it on Microsoft’s datacenter. Neither can you directly access the (virtual) machine hosting your application.

Figure 1: Windows Azure’s architecture.

Instead, you have to follow development rules to make sure your applications are Azure compatible. Configurations are done by using a web-based portal where you can change settings for your applications. Presently, this portal is somewhat limited, but more functionality will surely appear on the site later.

Currently, you can develop two kinds of applications that run on the Windows Azure platform. Both these applications can in turn use the other remaining services: data, .NET, and Live services. The two types that you can develop are ASP.NET web applications and so-called background applications (Microsoft calls these roles). ASP.NET web applications are equal to the traditional ASP.NET web applications, whereas background applications perform tasks on the Azure platform on their own. For instance, they could read records from a database on the Azure datacenters, perform processing on them, and then store the results back to the database.

In this article, you are going to learn how to write a simple ASP.NET web application (a web role) that is hosted on the Azure platform. If you are already familiar with ASP.NET development, you can use your existing skills to get up to speed in no time. If, instead, you are not yet familiar with ASP.NET, you should spend some time in familiarizing yourself with this technology. After that, you are able to better benefit from Windows Azure.

A Quick Example: Your First Azure Web Application

As with many complex technologies, it is possible to write about them at length. But more often than not, a simple example will better summarize the workings of the system. Thus, you next will learn how to build a simple Windows Azure web application using Visual Studio 2008. But before firing up Visual Studio, you need to make sure you have the prerequisites installed.

To develop Azure applications in Visual Studio, you need both the Windows Azure SDK and the Azure tools for Visual Studio installed. This SDK and the tools are free downloads from Microsoft (see the end of the article for download links). The SDK works on machines that have Windows Vista SP1 of Windows Server 2008 installed; unfortunately, Windows XP will not do. You also will need to have IIS web server installed on your development machine. Finally, to test and debug your solutions locally, a local installation of SQL Server Express is required.

With all the necessary tools and applications installed, you can start Visual Studio (it is important to do this with Administrator rights). Next, create a new Azure project (see Figure 2). Upon starting a cloud service project, Visual Studio will create a skeleton application for you; you can use this as the starting point for your own work. The solution will actually contain two projects, one for settings and one for the actual ASP.NET web application.

Figure 2: After installing the Visual Studio Tools, a new project type will appear in the New Project dialog box.

The classic Hello World application is easy to write. You can just edit the Default.aspx file in the ASP.NET project to display the text you want. You also could add a button and write some code, for instance. Once you are done with the development, you can test your application locally using a development fabric that is installed along with the Azure SDK.

When you are happy with your application, the next step is to deploy it to the Azure cloud. This requires several steps on the web. Firstly, you need to log in to the Azure Services Developer Portal; you can access this by going to (this redirects you to the correct site). Here, click the Sign In link (see Figure 3). Note that although the current preview version is free to use, you will require a so-called invitation code or token to access the site. You can apply for the preview on the same page. It will usually take a couple of days to get the tokens.

Figure 3: The Azure portal page.

With the tokens, you can create an account on the portal, and then proceed to create a hosted application (see Figure 4). You will need to specify a unique name for your application. The name has to be unique among all Azure users, and names are taken in a first-come, first-served basis.

Figure 4: When creating a new hosted application, you need to specify a project name.

With a hosted application created, you can start deploying your application to the cloud. The portal page gives an application ID number for each application you create through the portal. You will need this ID when copying it to the project page in Visual Studio (see Figure 5).

Figure 5: Setting the application ID in the Visual Studio project properties window.

The next step is to publish the Visual Studio solution to the portal. The easiest way to do this is to return to Visual Studio, right-click the project (either one will do), and choose Publish from the shortcut menu. This will create an application package from your solution, and open Windows Explorer to see the files in the binDebugPublish folder under the solution directory.

In this folder, you will find two files: a .cspkg file for your application (this is a ZIP file that you can view after renaming the extension) and a .cscfg file for configuration settings. You will need both files to deploy your application to the cloud. You will also need to specify a label that can be something simple as “First version” or “With database connection.”

After providing the files (the current CTP version sometimes requires you to upload the same configuration file twice with no apparent reason), the solution is loaded into a staging (testing) site. You also will get an URL for the staging server, such as To test your application, click the Run button on the portal and navigate to the URL given with your browser.

The portal page also has a promotion button (see Figure 6) that you can use to copy the application to the production server. After this promotion, your application will run on the production web address which you designated earlier (such as when creating the application on the portal.

Figure 6: Promoting a web application from the staging server to production.

If you try this web address with your browser, you should see your Hello World application running in the cloud. Congratulations!

Service Types Explained

Now that you have learned how to create a quick and simple Windows Azure application using the web role (the ASP.NET application type), it’s time to delve a bit deeper into the different services available on the Azure platform. As you will recall from the previous discussion, there are four service categories: Azure itself, .NET services, SQL services, and Live services.

The Azure service is probably the easiest to understand. With this service, you can create an ASP.NET application and a background application which can run constantly on the cloud and perform work on its own. The background role is useful for batch processing or computing, for instance. In addition to providing application execution services, the Azure service also supports rudimentary data storage using blobs, queues, and tables. These three ways to access data share a common web-based interface using a REST-like addressing (REST stands for Representational State Transfer). This means that you can access the data on the cloud from any application or programming language that can construct HTTP queries. Thus, the service isn’t limited only to .NET code.

For instance, to create a table, you could construct an XML command such as the following, and send it to the Azure system using a HTTP POST command to an URL like

<?xml version="1.0" encoding="utf-8"?>
<entry xmlns_d="
   <title />
   <updated />
      <name />
   <id />
   <content type="application/xml">

Although accessing data over HTTP is fine for simple needs, most business applications require better, more relational-like databases. This is exactly what the SQL services are for. But, unlike what you might guess from the name, Azure does not (yet?) have a hosted instance of SQL Server running on the cloud that you could connect to directly. Instead, you will have to settle with a semi-relational model. In fact, a table in SQL Data Services is more like a collection of entities that can have properties of different types.

Azure also supports a service called “.NET Service.” The purpose of this service is to help applications control access to their features, allow creation of a service bus, and finally support long-running workflows. The .NET Access Control Service, which is part of the .NET Service, supports application authentication and access control using the standard SAML language (Security Assertion Markup Language). The language uses digitally signed tokens to know who is who, and also allows transferring authentication data between different applications.

The service bus concept allows easy publishing of web based services to the public. The idea is that the service bus is a central place to publish web services (either REST or SOAP based), and also allows easier locating of services connected to the bus. Of course, you could develop your own web services by hosting them in your own servers or even on Azure, but the idea of the service bus is to help locate and connect applications together to create composite applications.

The workflow service allows you to run long-running processes in the cloud. Microsoft has a on-site installed product called BizTalk to support workflows, and also the .NET Workflow Foundation part of .NET 3.0 supports workflows. Workflows are especially useful in enterprise applications and integration projects.

The final set of services related to Azure is the Live Services umbrella. Live Services contains a diverse set of functionality from data synchronization to directory and communication services. The so-called Live Operating Environment lets you access Live services in the cloud in a coherent manner. Just as with the SQL Services, resources in the Live environment can be accessed with HTTP URLs, which makes it an easy way in to the services from almost any application or platform.

A Database Example Using SQL Data Services

In the earlier example, you saw a quick walkthrough on how to create a Hello World style Azure application. But, how would you access data in the cloud using the SQL Data Services? See a concrete example to help you learn.

As with the Azure data storage, the SQL Data Services support REST-based interfaces that use the HTTP protocol methods GET, POST, CREATE, and DELETE (the basic CRUD operations). Although using these features from C# code is quite simple, it is somewhat tedious. Because the SQL Data Services also supports SOAP (web services) interfaces, you will find it easier to write code to use this interface instead of REST and HTTP.

To begin using the web service interface, you will need to start a new Visual Studio project and add a service reference to your project. The URL to access the SOAP interface of the SQL Data Services is:

Figure 7: The SDS portal allows you to set your own password.

With the solution created and a Visual Studio project in place, it is time to code. The SQL Data Service uses three important terms that you have to familiarize yourself with. First, an authority is a collective name for data that belongs to a database. A solution has one or more authorities. Each authority in turn can contain one or more containers; you could use them to relate to tables in regular SQL databases.

The “records” in SQL Data Services are called entities. But unlike in traditional SQL tables, entities do not have to be of a certain type; instead, entities store their values in properties. Properties are simply name/value pairs, where the value can be any object type you choose. Each entity has an identifier (a string) that you can also freely specify.

With the SOAP interface object, creating authorities and containers is the first step. For instance, you might write an application like that shown in Figure 8. The following code creates an authority with the given name “abc”:

private void createAuthorityButton_Click(object sender,
   EventArgs e)
   SitkaSoapServiceClient soapClient = GetSoapClient();

   Scope scope = new Scope();
   Authority auth = new Authority();
   auth.Id = "abc";
   soapClient.Create(scope, auth);

   MessageBox.Show("Authority created!");

Figure 8: The SQL Data Services sample application.

Notice how the word “Sitka” appears in the name of the web service interface. The GetSoapClient method is a custom method helping to create the SOAP client object and set access credentials. To create an authority, you need to define a scope object that is defined as part of the service interface. In this case, the scope needs no special settings. The authority object must have an unique name; this can be read from a simple text box in the example application. Then, creating the authority is a matter of a simple web service method call called Create.

Here is how getting the SOAP client object could be implemented:

private SitkaSoapServiceClient GetSoapClient()
   SitkaSoapServiceClient soapClient =
      new SitkaSoapServiceClient("BasicAuthEndpoint");
   soapClient.ClientCredentials.UserName.UserName =
   soapClient.ClientCredentials.UserName.Password =
   return soapClient;

Notice how the constructor of the SOAP client specifies an endpoint named “BasicAuthEndpoint”. The SOAP interface supports different authentication modes, and the easiest mode is the basic authentication mode. In this mode, setting the username and password is just a matter of assigning properties. As you will recall, you will get these credentials from the Azure web portal. The username is the name of the solution, for instance my_test.

Here is an example of creating a custom “personData” entity:

private void createEntityButton_Click(object sender,
   EventArgs e)
   SitkaSoapServiceClient soapClient = GetSoapClient();

   Scope scope = new Scope();
   scope.AuthorityId = authorityTextBox.Text.Trim();
   scope.ContainerId = containerTextBox.Text.Trim();
   Entity entity = new Entity();
   entity.Id = entityIdTextBox.Text.Trim();
   entity.Kind = "personData";

   entity.Properties = new Dictionary<string, object>();
   entity.Properties.Add("name", "John Doe");
   entity.Properties.Add("email", "");
   soapClient.Create(scope, entity);

   MessageBox.Show("Entity created!");

Note how the scope object is used to specify the correct authority and container. Of course, you must have previously created a container also. Without a container, there would not be any place to store the entities.


Windows Azure is an interesting new player in the world of cloud computing. Microsoft’s new platform will surely generate interest in the developer audience, but only time will tell how well it will stand against the competition. But, in these turbulent economic times, Microsoft will surely hope that Azure is one of the company’s silver-lined clouds.

Developing applications for the Azure platform is quite easy, but the problem is that finding the right trail in the jungle of different solution types, their web portals, invitation codes, and passwords is still difficult. But, given the preview nature of Azure, this is to be expected. In time, Microsoft will without doubt improve these matters, which is key to wider adoption of the platform.

In this article, you learned about the basics of the Azure platform, why it is important, and what services it offers. You also saw how you can develop applications this new platform, for example, by writing ASP.NET web applications. Similarly, you saw how the SQL Data Services (SDS) can be utilized through the SOAP interface.

With this information, you are ready to start your own testing of the platform. First, apply for the mandatory invitation codes, and then begin experimenting. There is already lots of information about Azure development on MSDN; the Links section of this article will point you to the right direction.

Good luck with your cloud computing efforts!

Jani Järvinen

Download the Code

You can download the code that accompanies this article here.


About the Author

Jani Järvinen is a software development trainer and consultant in Finland. He is a Microsoft C# MVP and a frequent author who has published three books about software development. He is the group leader of a Finnish software development expert group at His blog can be found at You can send him mail by clicking on his name at the top of the article.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories