This blog article has been migrated from my old blog and updated. You can read the original post here
Update 2015: Cloud Services as it exists today is undergoing a significant change. If you want to deploy to stateless VMs like Cloud Services you can use VM Scale Sets
The question of the week is. When do you use Azure Web Apps as your web platform and when do you use Cloud Services. These two platforms provide similar functionality in that you can deploy your ASP.NET or other IIS based web application projects to either of these platforms. There are some general cases of when to use one over the other and some specific differences that may help in making that decision. In this post I am going to go through these differences and attempt to give some guidance on what to use when.
When to use Web Apps
You Are Just Starting - Compared to Cloud Services, Web Apps may not be as flexible but it is definitely easier. You can build your website using Visual Studio, WebMatrix, or any other IDE of your choice without the need for an SDK or any other additional software.
You can deploy to Azure Web Apps using WebDeploy, FTP, or even DropBox. You can sync your site code straight from GitHub, BitBucket, Codeplex, or TFS Online. It is incredibly easy and require little to know buy-in to Azure if you want to create an IIS website.
You Have a Single Compute Tier - If you are running an application that does not require internal communication then it would be much easier to use Web Apps . Again, the stance that I usually take is use the easiest option until you are required to change. If you need multiple machines that talk to each other over a private network, then you cannot use Web Apps and you need to use Cloud Services (or Virtual Machines).
With Web Apps you can have multiple servers handling requests if you have a high load, however those servers know nothing of each other and do not have internal addresses or endpoints.
Your Site is Written in PHP, Python, or Node.js - This point is not to say that you cannot use these platforms on Cloud Services, it is just easier with Web Apps because the machines are configured beforehand. With Cloud Services you get a base Azure Image to deploy onto. The Azure Website system uses that same base image however extra software has been installed to IIS for your convenience.
When to use Cloud ServicesYou Need Machine Level Access - If you compare the underlying platform of Web Apps and Cloud Services, Cloud Services provides you with a completely provisioned, unique, stateless virtual machine whereas Web Apps provides pre-configured IIS application pool, and you may be on the same machine as other sites. With IIS there are many restrictions, not the least of them is machine level access. This restriction could affect the base functionality of .NET like using PFX certificates to sign network tokens, or accessing local user profile data.
When deploying to Cloud Services there is no shared option, this deployment owns the entire virtual machine for its lifetime (which could vary, it is not a state-full instance). This gives you much more control over the deployment environment compared to Web Apps .
You Perform Background Processing - The Cloud Services platform has two different Role Types, a Web Role, and a Worker Role. If you are familiar with on-premise architectures you can compare the two to an IIS Application and a Windows Service. Azure Web Apps is all IIS, the web server provides the entire platform, there is no room for long running processes or threads that can sit and wait for communication on another port outside of IIS.
Note: For regularly scheduled or triggered operations you can use Azure Web Jobs which run as a sub-set of an Azure Web App.
If those Windows Service type scenarios are sounding familiar to you, you may need to consider using Cloud Services for the Worker Role capabilities.
Your Application Requires Internal Communication - With Windows Azure services there is a general level of scaleability. Both Cloud Services and Azure Web Apps can scale up and down as needed, even automatically. However, if you want to use 2 web front-end machines and they need to communicate to each other, you need to use Cloud Services Roles and Instances. Azure Web Apps take routed requests in a farm of IIS hosting servers, they have no knowledge of other machines in the same site.
Cloud Services however runs as an overall deployment with multiple Roles and each of those Roles can contain multiple Instances. You can scale different components of your system separate from others. Cloud Service deployments also have an internal network all to themselves to use to communicate between the Roles and Instances. The Azure SDK contains .NET Libraries to determine which machine is the current instance and where to contact the others.
Feature BreakdownFor those more specific features that may sway your decision one way or the other, here is a quick table comparing the two.
|Feature||Web Apps||Cloud Services|
|Scale Out to Multiple Instances Without Redeploy||Yes||Yes|
|Visual Studio Integration||Yes||Yes|
|Deploy from TFS On-Prem or Online||Yes||Yes|
|Instances Share Content and Configuration||Yes||No|
|Multiple Deployment Environments (Production and Staging)||Yes||Yes|
|Support for Windows Azure Traffic Manager||Yes||Yes|
|Support for CDN||Yes||Yes|
|Remote Desktop Access||No||Yes|
|Execute Start-Up Tasks||No||Yes|
SummaryIf the above information has just left you more confused, here are some basic guidelines that I use for many Azure service match-ups.
Use what you need, until you need more, then switch.
That said, start by creating an Azure Website (hey, it's free right), get your application out into the world. If you find that you require more complexity and you are considering a multi-tier scenario, consider switching to Cloud Services.
As always, thanks for reading!