An Overview Of Microsoft Azure For The Casual Back-End Developer

This is a companion post for my Portland Maine Web Developer Group Meetup talk, presented on April 13, 2015.

Cloud computing is all the rage, and for good reason: The right cloud tools allow you to make robust, resilient and very reliable applications.

From the ability to scale your solutions to meet demand, through developing “microservices” that can be recycled among multiple applications, to handling failure points with little to no downtime for your entire solution, the cloud makes possible service that would be difficult and expensive to do with your own infrastructure.

Microsoft has (somewhat belatedly) entered the cloud computing market with Azure, a fleet of infrastructure as a service (IaaS), platform as a service (PaaS) and cloud-based versions (SaaS) of its technologies.

Even if you “don’t do Windows,” Azure provides a number of features that can be leveraged using popular programming languages like node.js, Python, PHP and Java; as well as the ability to spin up virtual machines that can run Linux, Windows and Oracle operating systems, among others.

It’s important to note that I am not affiliated with Microsoft in any meaningful way. Yes, I program in .NET and have done so for a number of years; but that’s it.

I’m not an affiliate nor an employee. I have received some swag from Microsoft over the years, when participating in developer events, but I’m most certainly not getting anything for free from Azure and have not been compensated in any way for this post or talk.

This post, and its related Meetup talk, should come as a total surprise to Microsoft and its representatives.

The Jamy wifi-enabled weather toaster, a concept by designer Nathan Brunstein.
The Jamy wifi-enabled weather toaster, a concept by designer Nathan Brunstein.

Cloud Computing Basics

Let’s get a quick overview of the common offerings of cloud computing vendors. This will help frame Azure’s services and how you might use them.

The big cloud computing vendors (Amazon, Google, Rackspace and Microsoft, for example) all offer a few core services:

  • Storage: That is, places where you can store and access files or binary information of some sort.
  • Compute: Resources that do the actual processing of data.
  • Big data: If you are collecting loads of telemetry from things like smartphone apps, wearable devices, wifi-enabled toasters and the like, you need both buckets into which to deposit that data, and something that can sort through those buckets and make sense of the tons of data you’ve collected.
  • Virtual networks: Because cloud computing tends to tie together many different resources, you need a means of ensuring those resources can communicate with each other as though they were standalone computers in a network rack, so that you get peak performance at minimal cost. This is accomplished through the use of virtual networks, which are basically a means of telling your cloud provider which resources are interdependent for a given solution and getting that provider to connect them efficiently.
  • API management: The nature of cloud-based computing is to disconnect, across many different services, the business logic that actually produces usable information, then provide HTTP-friendly endpoints through which those services talk to each other. This is commonly called “microservices architecture,” and it relies heavily upon application programming interfaces to communicate back and forth among its parts. Therefore, any decent cloud computing option needs tools that let you manage the many APIs you build as part of a microservice-based solution.
  • Monitoring and resources management: Since two of the primary benefits of cloud computing are scale (the ability to allocate, and deallocate, memory and CPU cycles as demand requires) and robustness (the ability of your application to quickly recover, or work around, a failure point), you also need a means to watch what your cloud services are doing and to manage those services on-the-fly / automagically.
Screenshot of the home page of the Azure PHP developer center.
Screenshot of the home page of the Azure PHP developer center.

Azure’s Language Support

Cloud services aren’t any use to you if you can’t program them with your language base. Microsoft has done a fair amount of legwork here by providing samples, libraries and documentation for PHP, Node.js, Python, Ruby and Java.

They also have a lot of code on github. And you can find code samples splashed all over microsoft.com and azure.com; too many to get into here.

That said, you are going to be able to leverage a lot more resources a lot easier if you develop for Azure in .NET.

It is technically true that when Microsoft open-sourced the .NET framework recently, and made it portable to most popular operating systems, that the .NET restriction became less onerous. Also, Microsoft is working to break up the monolithic nature of .NET, especially for cloud / web applications, which should help developers implement it more effectively on non-Windows environments.

But for the moment, .NET works best on Windows, and Azure works best on .NET. That might not be the case forever, but it is for now.

That said, you can get a lot out of Azure using the other languages mentioned here. So if you don’t have a lot of .NET programming skills, or any at all, you can probably use some part of Azure; almost certainly, you can use its core services.

One final caution: If you’re used to writing procedural PHP code, you’ll face a somewhat sharp learning curve to develop in Azure, since the libraries and sample code are written for object-oriented programming.

That’s not to say that using Azure is difficult; just that you need to understand how objects work in PHP if you expect to use the Azure libraries.

Azure storage
The different kinds of Azure storage options. Does not include the recently released DocumentDB. Via Bruno Takarly at Microsoft blogs.

Storage

Azure has a couple of different kinds of storage services, including those that are useful for backing up your files a la Dropbox / CrashPlan and the like.

I’m going to focus on the kind of storage used for cloud-based applications, which is called, plainly, Azure Storage.

Storage allows you to save multiple kinds of data.

Simple, everyday file storage is held in “blob” storage (binary large objects; indicating that it doesn’t matter if you are storing an HTML file, some JSON, a picture, a ZIP file or whatever; it’s all the same to Azure).

Blob storage is, by default, configured to privately hold georeplicated copies of files. When you need a file, you retrieve (and possibly serve) it programatically.

However, it’s possible to directly serve files from Azure Storage. For example, I’ve developed a number of robots that save JSON files to Azure Storage; by applying CORS rules to those files, I can directly access that JSON from client-side JavaScript.

Azure also has table storage. You can think of tables as a sort of NoSQL data store; while each record has a key, and it’s somewhat possible to make relational queries against records stored in Azure tables, it’s difficult to make deeply relational queries.

However, if you just want to store non-complex records, tables are an option.

Azure also recently released DocumentDB, which is a kind of NoSQL storage that uses JSON; so if you want to store records that are largely consumed client-side as read-only, that’s an option.

In addition to these file storage options, Azure offers message queues, which it calls Service Bus.

A message queue is basically a way for components of an application to pass messages back and forth.

For example, suppose you have a Web site that accepts image uploads. You want to resize these images, as they come in; maybe make a thumbnail and a couple other sizes of the image, for display in a gallery.

Having your upload program wait for this work to be done is extremely inefficient. It’s far better to write another program that does this resizing outside the upload process, and reports its results to the upload program.

To that end, you would create a message queue in which the upload program provides some worker process with a message, letting it know there is an image to resize. The worker process listens for these messages, and once one is received, does the resizing job.

It then might send a message back to the upload processor, also via a queue, letting it know when the resizing is done. The upload site could then report back to the end user whether all went well or if there was a problem with the job.

Finally, Microsoft classifies its SQL Server cloud offerings as storage. However, I think of this as an PaaS offering, rather than document storage in the abstract.

SQL Server on Azure isn’t as robust as a Windows-based install. For example, replication services aren’t nearly as good with the cloud-based version of SQL Server as the server-based versions, and Microsoft hasn’t really come up with a good way of ensuring rapid failover recovery for a SQL Server database in the cloud.

This is a significant shortcoming of the Azure SQL service, in my opinion.

At this writing, a purely Azure-powered PaaS SQL Server can’t be failed over, without data loss, in less than 5 minutes. This might not seem like a huge delay, but if you need mission-critical interoperability with hundreds or thousands of record inserts / updates conducted every minute, a 5-minute blackout might as well be a million years.

Of course, you can always create Azure VMs with SQL Server installed on them, which gives you the advantages of AlwaysOn and considerably more robust replication. Or you can build in backup routines that record failover records to some other source and then merges them when the Azure-based SQL Server database comes back online. But the real solution is for Microsoft to come up with a fix that recovers lost / damaged databases far more quickly than it does now.

And technically, Azure has support for other databases. A partner of theirs provides MySQL; MongoDB can be purchased as an add-on, and you can also spin up virtual machines with Oracle installed and preconfigured.

Preconfigured PaaS server options in the Microsoft Azure portal. There are lots more than these, and hundreds of options for spinning up servers configured to support specific applications.
Preconfigured PaaS server options in the Microsoft Azure portal. There are lots more than these, and hundreds of options for spinning up servers configured to support specific applications.

Compute

Microsoft offers two kinds of cloud computing resources: infrastructure as a service (IaaS) and platform as a service (PaaS).

Infrastucture as a service” basically means virtual machines. Microsoft prices VMs by the hour, based on the CPU and memory used by the instance, the operating system installed on the VM, and sometimes on what additional software is installed.

Azure has the ability to spin up single virtual machines that range from 1 core and 0.75 GB of memory all the way up to 16 cores and 112 GB of memory.

Additionally, you can select a number of predefined disk images for your virtual machine, including software from lots of different vendors, most notably Ubuntu, CoreOS, openSUSE and Oracle. Microsoft also has server images for its own products, including SharePoint, BizTalk, Dynamics, Team Foundation Server and SQL Server.

Several technology vendors have also included images with their software preloaded and preconfigured.

In most cases, licensing costs for VM’s operating system is included in your hourly price. For example, if you spin up an instance of Windows Server 2012 R2, the price of that operating system is included in the hourly charge for your VM.

Pricing for software is sometimes included in the hourly price, but usually requires the purchase of a license key. For example, an Oracle database VM will include the license fee as part of its hourly charges. But if you want a VM that runs Microsoft Dynamics, you can spin that machine up from the VM galley on Azure but will need to purchase a license key to run Dynamics in production.

IaaS machines can be autoscaled based on resource demand or on a schedule. For example, suppose you have an application that tends to be twice as busy from 9 a.m. to 5 p.m. on weekdays. You can easily set a schedule that automatically adds a second instance during those hours.

You can also “spin up” additional instances of your VMs based on resource use. For example, if you hit 80 percent CPU or memory load, you can have a second instance come up, and automatically deallocate the second instance once usage goes down.

Finally, you can create “availability sets” for your VMs. This is a way to group virtual machines together, so that when routine maintenance — or crashes — occur, your VM will fail over to another VM in the same availability set, ensuring continuity of service.

Platform as a Service basically means placing an application into a pool of resources that act like a virtual machine, but in which you’re not concerned with managing an actual machine.

In other words, your application runs using whatever resources it needs, and Azure secures the CPU time and memory needed automagically. Microsoft calls these instances “Cloud Services.”

The benefit of this approach is that you can far more easily spin up and scale PaaS instances vs. IaaS services.

That is, rather than having to create a virtual machine, then install your code, configure the machine to run that code properly, and then go through a complex setup to ensure your availability set successfully works, you can just install a single code base, load up as many instances of that service as you need, allocate exactly the resources it needs to perform properly, and configure simple rules for getting it to scale to meet real-world conditions.

That is, you get all the benefits of your code running on a server, without any of the fuss involved in managing a server.

The drawbacks are, of course, that you don’t have an actual server you can control.

So if your application needs special user permissions or other highly specific server configurations, or relies on the local filesystem (for example, it needs to get files from FTP), or otherwise isn’t easily divorced from its environment, then PaaS is going to be more trouble than it’s worth.

Azure App Service, from Scott Guthrie’s blog.

Web Hosting

Azure formerly had two kinds of web hosting. Its (kind of) IaaS service was called Web Sites, and its PaaS service was called Web Roles.

The benefits of each were similar to the differences between PaaS and IaaS for programs. While you can still technically order these services from Microsoft, they are clearly transitioning away from this approach to web hosting.

Microsoft recently rebranded its web hosting platform, reflecting a change in strategy to make the process of hosting cloud-based solutions, regardless of type, less like old-school server solutions and more like plug-and-play components.

As part of that, web hosting is now called a Web App, and creating it is much more like spinning up a virtual machine. This new service allows about the same flexibility of the former Web Sites option, but with a feel that is more like requesting PaaS.

You can choose to create an empty service or install any of a host of predefined programs, such as WordPress, Drupal, etc. You have some ability to configure the environment and some access to the local filesystem, but overall the intent is to disconnect the compute part of the website (i.e. the HTTP daemon) from the filesystem (i.e., where content is stored, especially static content such as images).

Azure App Service promo via Twitter.

APIs And Automation

As part of that restructuring of Web hosting, Azure recently released two new tools that support automated workflows / resource management: Logic Apps and API Apps.

You can think of Logic Apps as your own, personal version of IFTTT and Mashery. You create workflows that are driven by some kind of event — the IFTTT part of Logic Apps — which, in turn, can pull from objects defined in your cloud-based database, application or even another API (the Mashery part of Logic Apps).

I’ve not had a chance to use this tool, but you can see a demo of how it works via this video from Microsoft’s Channel 9:

As a builder of middleware and robots, it’s nice to have a tool like this which can quickly create data pipelines and handle straightforward / routine data migration tasks. Logic Apps probably aren’t going to put me out of business, but they are going to make my life a lot easier.

Which naturally brings us to API Apps, which are basically an implementation of Swagger.

API Apps streamline the process of managing and documenting your APIs. It also makes cross-integrating data from many APIs — such as Twitter, Facebook, Salesforce, etc. — a heck of a lot easier, largely by allowing you to transfer authentication tokens across several points of a workflow.

A really nifty feature of API Apps is the automated documentation of API endpoints.

The Hadoop ecosystem, via the Microsoft TechNet wiki.

Big Data

I’m not currently using Azure’s big data tools, so I can’t really get into them in depth.

Azure has a number of solutions surrounding big data.

One of its first offerings was HDInsight, which is an implementation of Apache Hadoop.

Other big data offerings include a predictive analytics service Microsoft calls Machine Learning (think “IBM Watson“) and an in-the-moment and historical analytics service called Stream Analytics (think “Google Analytics“).

To receive big data / Internet of Things information, against which these analysis features can run, Azure has Event Hubs.

Finally, if you develop smartphone / tablet applications that receive push notifications, Azure provides a service that allows you to manage those notices to your clients. This service is called Notification Hubs and supports just about any OS capable of receiving push notifications, including iOS, Android, Windows 8 and Kindle.

Additional Developer Tools

There are four tools left to discuss that are of use to the average developer:

CDNs: Azure includes the ability to serve your Storage items from a CDN endpoint. The effectiveness of an Azure CDN depends, of course, on your Storage objects being distributed globally, too; and because your CDN will have a unique URL, you won’t see significant caching benefits. But this option is out there.

Media Services: Azure can quickly encode media streams and serve stored streams as well; it can also encode streams with digital rights management encryption.

Media Services makes sense if your business is all about live video, or you have tons of video that needs to be served reliably. Otherwise, it’s fairly expensive and rather difficult to use.

Active Directory: If you use Office 365, Exchange, SharePoint or other Microsoft services to manage identity or your network, you can host your Active Directory install on Azure. Also, you can create a standalone AD install.

The benefit of an Azure-based Active Directory install is that you can easily use it for authentication. So, if you want to build a company intranet, or a Web application or API that can only be used by people in your AD, it’s quite easy to accomplish via Azure.

Visual Studio Online: If you develop in .NET, you can link your Visual Studio Online account to Azure, for continuous deployment. Also, you can lease Visual Studio users and Visual Studio Professional software on a monthly basis through Azure, which represents a significant savings over purchasing either Team Foundation Server seats or VS 2013 licenses.

It’s worth noting, however, that Microsoft has (wisely) created a free, fully functional version of Visual Studio 2013 and Visual Studio Online; small teams working on average products needs not pay a cent for either.

Azure discoveries promo art via Twitter.

The Lowdown

My employer has been using Azure for about a year now. Here are the pros and cons, as I see them, so far:

It’s rock-solid and very reliable. There was a major incident last year with Azure Storage that also affected virtual machines (IaaS) for a day. Also, there was a planned, 12-hour outage in the US East datacenter over an October weekend that took down most services. Other than that, the service is rock-solid and reliable. I have several mission-critical services running on Azure and not a one has died unexpectedly.

Some of it is cheap; some of it is expensive. Storage and bandwidth are incredibly cheap; on par with the rates charged by other vendors. Very basic compute services, such as VMs and worker roles that have a single core and low memory, are comparable to the prices other cloud vendors charge.

However, a standard-service, Windows Server 2012 R2, four-core CPU with 10 GB of memory is as costly than a similar rack-mounted unit would cost in a colocation. (Of course, the benefit is that a cloud server recovers faster; just attach a working disk image to a new instance and you’re back from disaster in no time. And you can run multiple instances of the same server quite easily in Azure.)

Its cost is difficult to compute, especially in advance, and somewhat difficult to manage. It is difficult to tell how much Azure will cost you every month, especially if you are autoscaling services based on demand; and if you design your solutions to make maximum use of Azure, it’s nearly impossible to do anything about your costs.

There is a price calculator that can give you a ballpark figure for cost, but depending on how you draw up your cloud service, it can still be hard to tell what your service is going to cost. If all you have is a single website, you can divine from server logs what typical load and bandwidth demand will look like over a month, and plan accordingly; if you build a microservice that has 10 worker roles, three APIs and several Storage containers, plus associated services to help tie all that together, getting an exact price up front is going to be nearly impossible.

This is true of all a la carte, pay-for-use cloud providers; but it is also frustrating, especially if your bosses require a price before buying.

You really want to use .NET with it. I know I spent quite a bit of time talking about how Azure supports several programming languages, and that most of its services are language-agnostic, if not platform-agnostic.

That said, you will get the most out of Azure if you are used to Microsoft’s way of doing things and the .NET way of writing code. Yes, everyone can find something in Azure to use, and Microsoft is successfully finding ways to divorce its software from its services. Nonetheless, there’s little in terms of non-Microsoft offerings in Azure that can’t be found at Google or Amazon.

Where Azure sings is in bringing .NET-based programs to the cloud, and that’s likely to be its strength, and primary benefit over Google and Amazon, for the foreseeable future.

Azure promotion via Twitter.

Resources

If you want to learn more about Azure, here are some places to look:

Boston Azure: Meetup group focused specifically on using Azure. Current and former Microsoft employees are often presenters. Well worth the drive if you’re interested.

Global Azure Bootcamp: If you’re the type who learns best by diving in headfirst, there is a day-long bootcamp being held worldwide on April 25. The nearest location for the bootcamp that has open slots still is in Watertown, Mass., at BlueMetal Architects, a Microsoft technologies development shop that is well-versed in Azure.

The idea behind the bootcamp is simple: People worldwide collaborate on a monster compute for charity, deploying its component parts as they go along. It may seem that you would need to be well-versed in Azure to participate, but in fact there’s so much to do that you can immediately contribute something, even if you’re starting from scratch.

Azure documentation: Microsoft has its problems, but one of the things it’s really good at is documentation. That’s certainly true of Azure. Basic tasks are usually documented in a way that even complete beginners can understand. More advanced topics are usually documented, too, but require a pretty thorough understanding of how Azure works in order to understand.

Azure blog: Whatever’s going on, you can usually find out about here.

@Azure: There’s a fair amount of marketing in this Twitter feed, but there’s also lots of tweets to specific examples and training documents.

Microsoft Virtual Academy: On-demand and live video events that go over how to use Azure services.

Azure Friday: A video podcast that focuses specifically on Microsoft Azure features.

All links in this post on delicious: https://delicious.com/dougvdotcom/an-overview-of-microsoft-azure-for-the-casual-back-end-developer

1 Comment

Leave a Reply

  • Check out the Commenting Guidelines before commenting, please!
  • Want to share code? Please put it into a GitHub Gist, CodePen or pastebin and link to that in your comment.
  • Just have a line or two of markup? Wrap them in an appropriate SyntaxHighlighter Evolved shortcode for your programming language, please!