Guide to Microsoft Azure

The demand for software and related services today is greater than ever before, and this trend will only continue—exponentially so—as applications of all sorts more and more become a part of every aspect of our daily lives. You, as a developer, are the "magician" who is bringing this digital revolution to your users, and that's not easy. Besides creating the unique tangible features that your software offers, there are so many behind-the-scenes elements that you need to take care of: your applications need to be highly available, performant all over the world, function seamlessly on a wide range of devices, be secure, and be able to run at massive scale for a reasonable price. These challenges are common across most software and most industries. The solutions, however, are ephemeral things that we keep reinventing, and they can be difficult and costly to build and maintain.

We created The Developer's Guide to Microsoft Azure to help you on your journey to the cloud, whether you're just considering making the move, or you've already decided and are underway. This e-book was written by developers for developers. And it is specifically meant to give you, as a developer, a fundamental knowledge of what Azure is all about, what it offers you and your organization, and how to take advantage of it all.

The second half of the guide walks you through scenarios such as a tour of the Azure Portal and creating a Virtual Machine. We also discuss developing and deploying a web application that uses Node.js and MongoDB. We cover typical tasks such as CI/CD (Continuous Integrations and Continuous Deployment), staging environments, scaling, logging, and monitoring. We wrap up by creating a backend for your mobile application that includes authentication and offline synchronization.


There are countless books, articles, papers, blog posts, and so on that espouse the virtues of cloud computing, and you can find zetabytes worth of information that explain what cloud computing is in a technical sense. But before getting into any of that, you need to ask a couple of simple questions: why should I make the move to the cloud at all? How will it benefit me; my team; my company?

Information technology as a utility, not a burden

Cloud computing is computing as a utility. What do we mean by this? To help you visualize it, consider something else that's ubiquitous in your life: electricity.

Who today would think that having a mini-generating plant outside each home and business would be an efficient model for the distribution of electric power. We are accustomed to simply flipping a switch to turn on a light, and then we go about doing what we need to do; you certainly would never dream of having to buy, install, and maintain all of the equipment needed to illuminate your home or office. Instead, you pay your local electric company for the power you consume every month, and you never need to concern yourself with the physics of generating electricity, dealing with the capital expense, maintaining the equipment, repairing it after storms—nothing. Just flip the switch, and be productive at something else.

Well, just as you neither need nor want to know exactly how electricity is delivered to your house, neither do you need to know exactly how the computing power and services that you consume in the cloud are made available to you. Someone else takes care of that for you. Thus, first and foremost, moving your compute, storage, and network to the cloud provides ease of use, just like turning on a lamp. And you pay only for what you use, in the same manner as you pay only for the electricity you use to power your home.

Of course, moving beyond our analogy, the cloud offers many more specific benefits for your IT operations, like scalability and the ability to use intelligent services like search and facial recognition in your applications, to name but just two.

Computing as a utility

So, ultimately, you can think of cloud services such as Azure as computing as a utility. Of course, Azure offers far more in the way of products and services than the local electric utility does, so cloud computing can sometimes be difficult to clearly define. In fact, some say that the cloud is basically just using somebody else's computers, which is technically true, but the cloud is so much more:

The cloud is a system that provides robust, resilient, intelligent services and compute resources at infinite, elastic, global scale.

Let's break that down:

The cloud and Azure provide services that help you to accomplish so many things: from the mundane, such as adding Search to your application, to the more exotic, such as implementing Continuous Integration (CI) and Continuous Deployment (CD) workflows. You can automatically tune your database, or set up push notifications to mobile devices, easily and quickly. These are just a few examples of some common things that developers have created for themselves over and over again but are now available as a service. This makes it possible for you to use these services with very little effort—almost like flipping a light switch! You can then focus on the pieces of your application that make it unique; the features that provide real added value for your users.

Besides services, the cloud offers compute resources in the form of Virtual Machines (VMs), containers, databases, and so on. You can use these to host applications or to provide a complete infrastructure for your users.

As we stated a moment ago, the power of the cloud is that services and resources are incredibly robust and resilient. It is very unlikely that they will fail to run. This is because the cloud is smart. It is self-healing and, as is the case with Azure, there are datacenters all over the world, filled with tens of thousands of servers. If one server fails, another takes over. If an entire datacenter were to fail (a highly unlikely scenario in and of itself), another would take over. All of this is possible because of the massive scale of the cloud.

One of the most compelling arguments in favor of the cloud is that you can scale-up your services and resources almost infinitely, and certainly to a degree that you simply can't do with on-premises resources, unless you're prepared to spend enormous sums of money on capital equipment and staffing to administer it all. And, you can scale globally. You can put your services anywhere in the world so that you can provide a performant experience to your users, regardless of where they are. It also means that you can keep your data where you need it to be.

Perhaps most important, though, when you use cloud resources, you can scale-back your services and resources when there is no longer high demand. Returning again to our electric utility analogy, if you're having many friends and relatives to your house for a party, you're going to turn on a lot of lights inside and outside the house, use your microwave oven frequently, turn on some music, and, generally, consume more electricity. But when the party is over and your guests have left, your power usage returns to normal, and so does your billing. It's the same thing when you take advantage of the cloud and Azure: you pay only for what you use, not for what you might need when usage is high.

In addition to massive scalability, off-the-shelve intelligent services, and pay-per-use efficiency, the cloud offers increased security.

The cloud is used by millions of people, 24x7, worldwide; of course, it is attacked by many people, as well. Reputable and experienced cloud providers like Microsoft know the usage patterns of normal users versus those of malicious actors. This means that it knows how to protect against both the most common and most unique attacks out there. Intelligent monitoring tools, machine learning algorithms, and artificial intelligence give cloud providers the ability to detect attacks in real time and stop them in their tracks.

Decades of experience in security and massive-scale traffic, combined with top industry security expertise, make the cloud a much more secure environment than any on-premises datacenter.

We've briefly explored the question of why you want to begin the migration to the cloud and Microsoft Azure. Now, let's examine the cloud's major components, what they do, and how they fit into the grand scheme.

Cloud computing deployment types

The cloud offers several levels of products and services, such as infrastructure as a service (IaaS) and platform as a service (PaaS), but before we get to those, let's step back and look at the three basic types of cloud platforms: public, private, and hybrid. These have rapidly become modern technology buzzwords. Let's demystify them.

The public cloud

In the public cloud model, you don't own any hardware; your cloud vendor is responsible for purchasing and maintaining all hardware. The public cloud consists of all of the services and compute resources that you do not own yourself but that you use from your cloud provider. The provider is responsible for keeping everything running and adhering to Service-Level Agreements (SLAs). You pay for what you use, not for what you own.

The private cloud

With a private cloud, you own all of the hardware or, at least, have complete control over it. The hardware that runs your services and houses your data is somewhere in your on-premises datacenter. Of course, this complete control comes at a price: you must purchase and maintain everything. You pay for what you own, not for what you use.

But, how do you set up a private cloud platform in a traditional on-premises datacenter. Fortunately, Azure provides a unique solution designed specifically to work in this environment: Azure Stack. In a nutshell, Azure Stack is your own private instance of Azure in a box that you can run in your onpremises datacenter.

Running services in a private cloud is not the same as running services in your on-premises datacenter. Azure Stack offers all of the advantages of Azure, including intelligent services that you can use in your applications, all within the confines of your on-premises datacenter. Thus, if for special security or governance reasons you need to keep certain operations "close to home" in your onpremises datacenter, you can still enjoy all of the benefits offered by Azure and the cloud paradigm.

The hybrid cloud

The hybrid cloud model is, as its name implies, a mixture between the public and the private cloud. You can use public cloud services that use resources in your private cloud, and vice versa. In Azure, you could run an application in an Azure Web App that connects to an on-premises database using Azure Hybrid Connections. This opens a lot of possibilities. You control where your applications and data are while still gaining the benefits of using intelligent cloud services.

Azure provides solutions for all cloud computing deployment types. This gives businesses more freedom to use Azure where and how they want to. And they can determine the amount of control that they want to have over their applications and data.

Demystifying the types of cloud computing

Within cloud computing, we can categorize services and resources into types. There are many different cloud computing type definitions. The differences between the types are the amount of control and responsibilities that you have versus the amount of time and effort you can spend on adding business value to your company or customers. Figure 1-1 and Figure 1-2 illustrate how we define cloud computing types for Azure.

Figure 1-1: Types of cloud computing explained

Figure 1-2: Examples of cloud-based offerings

Infrastructure as a service

With infrastructure as a service (IaaS [pronounced "eye-as"]), you are responsible for everything, except the hardware. Azure takes care of all the hardware, such as the solid-state drives (SSDs), network cabling, routers, power supplies, backup generators, cooling systems, and so on. Services that fall into this category include Azure Virtual Machines, Azure Virtual Networks, and Azure Containers.

You take care of everything else. Your application, patching of the operating system (OS), logical network configuration, and even keeping antivirus programs on the machines up to date. This means that you maintain total control over these elements. But, it also means that you spend a lot of time and effort keeping the services and resources running and less time working on adding business value to your core application products.

Platform as a service

Using the platform as a service (PaaS [pronounced "pahz"]) model, you are responsible for your application and its configuration; Azure provides the OS and hardware. As Figure 1-1 demonstrates, PaaS is an abstraction level higher than IaaS. You have far fewer responsibilities but less direct control over your hardware resources than with IaaS. Services that fall into the PaaS category are Azure App Service, Azure SQL Databases, and Azure Redis Cache.

With PaaS, you can host your application, but this level also offers additional capabilities that you can use out of the box, such as push notifications for mobile devices via Azure Mobile App, and automatically tuning your database in Azure SQL Database.

You deploy your application and configure it. You also do basic server configuration, like scaling the pricing tier or the number of instances on which your app runs. Your application still runs on a server somewhere, but you aren't responsible for that server (nor do you have any control over it), which means that you can spend much more time concentrating on adding business value to your applications, and less time keeping a server running.

Function as a service

In function as a service (FaaS [pronounced "fahz"]), you are responsible only for your application and your business logic. You don't need to worry about scaling, the OS, or any of the hardware. FaaS is sometimes called serverless computing. Services in the FaaS category are Azure Functions, Azure Logic Apps, and Azure Event Grid.

In FaaS, all you need to do is create your application or weave together business logic and run it. Scaling happens automatically. One of the more noteworthy benefits of FaaS is that you pay for the resources you use only when the logic runs instead of paying for a service that is always on, waiting for somebody to use it.

But FaaS does more than just host your application; it connects your logic to triggers and sources.

Outside sources such as Azure Storage Queues or WebHooks can initiate Azure Functions or Logic Apps and provide them with data to process. You do not need to write the activating logic or set up the plumbing to connect to external data stores or services, meaning you can focus on your logic and customer-facing features.

Software as a service

With software as a service (SaaS [pronounced "sass"]), you need only concern yourself with configuring the software—nothing else. Indeed, SaaS is the highest abstraction level of the cloud computing types. Services in the SaaS category include Azure Cognitive Services and Azure IoT Suite. Office 365 is another example of an Azure SaaS application suite, offering reliable business applications such as Microsoft Word, Excel, PowerPoint, and more. And all of this is available without you having to install or maintain anything.

With SaaS, the software is ready to use. All you need to do is configure it to your preferences and then you are ready to go. You don't write the software, and you don't need to think about deployment, scaling, operating systems, and hardware.