Azure Virtual Machine or Azure App Service. Which one should you choose?

All of the websites and web apps, running on the internet require some piece of hardware to run them. This hardware is also known as main-frame computer. This computer, on which website run, can be on-premises or can be hosted on a cloud server. There are many benefits of doing this on cloud. For eg: you don’t have to worry about the initial investment required to buy the hardware itself, you don’t have to maintain it and think about its 24 hours, 365 days availability, so that your website not goes down. Hence, many small to medium businesses prefer to host their websites on cloud platforms these days. And these platforms offer variety of services to hoast an application on cloud. But, as an developer, which one you should choose? In this article, we are going to look into two of those services, offered by Microsoft Azure. One is an Azure Virtual Machine, which is considered as IaaS (Infrastructure as a Service) and the other one is Azure App Service, which is a PaaS (Platform as a Service). We will discuss which service is better for different use-cases, and what are the differences between these two services.

Azure Virtual Machine

IaaS (Infrastructure-as-a-Service)

Azure Virtual Machine is a IaaS (Infrastructure-as-a-Service) cloud service by Microsoft. As the name suggests, this type of services tries to provide the on-premises services on a cloud platorm. This offers all the basic benefits, that one gets after shifting from on-premises to cloud. One can run their web application on Azure VM very easily, without actually worrying about certain aspects, that one has to take care while running the application on-premises. For eg: one does not have to worry about the 24 hour running operation of the machine, this is the duty of the cloud provider, to keep their servers available all the time. Cloud provider, in this case Microsoft, takes care of the physical security of the machine and the data centre itself. One does not have to invest capital to buy the hardware and maintain it. The customer only has to pay according to its usage with Pay-as-you-go pricing model. Hence, by clever usage, a customer can save a lot of money by moving to cloud. The customer only has to take care about the software aspects of the the VM like, choose the operating system to run your app, download the required entities to create virtual environment to run your app, timely applying software patches for operating system of the VM, security aspects of the VM, deploying the middleware to interact with frontend and the database.

So, basically one deploys application on Azure VM, in similar way, that it does on on-premises hardware. Only difference being, one does not have to buy the hardware, does not have responsibility to take care of it and only has to pay for what he uses.

To deploy an Azure VM running a Ubuntu, run the following command in the Azure CLI:

$ az group create --name resource-group-west --location westus2$ az vm create \
--resource-group "resource-group-west" \
--name "linux-vm-west" \
--location "westus2" \
--image "UbuntuLTS" \
--size "Standard_B1ls" \
--admin-username "uadmin" \
--generate-ssh-keys \
--verbose

To deploy an Azure VM using Azure portal, refer to the following documentation by Microsoft:

Azure App Service

PaaS (Platform-as-a-Service)

Azure App Service is PaaS (Platform-as-a-Service) cloud service by Microsoft. This service takes away some of the additional responsibilities of customer, and gives it back to cloud provider, for which customer is responsible while working with Azure VMs. For eg: in this service, customer does not have to worry about creating a middleware, installing the requirements to create a virtual environment, installing timely software patches for operating system etc. All of this is taken care by the cloud provider, i.e. Microsoft in this case. Developer only needs to deploy the code, and focus only on the development part of project. This is very useful for teams with less manpower, and less experience with managing such hardware.

Hence, Azure App service is simple and quick way of deploying web applications, without actually worrying about the underlying responsibilities of creating and deploying the environment.

To deploy an Azure App Service, run the following command in Azure CLI:

$ az group create --name resource-group-west --location westus2$ az webapp up \
--resource-group resource-group-west \
--name hello-world1234 \
--sku F1 \
--verbose

To further read about Azure App Service using Azure portal, refer to the following documentation by Microsoft:

So, which service should you choose?

These following important points about this services, will help you decide whether you should choose Azure VMs or Azure App Service for your use case:

  • Azure VMs are more expensive to run in comparison to Azure App Service.
  • Azure App Service have constraints in comparison to Azure VMs in terms of scalability. Hence, Azure VMs are preferred for apps, which have scope to expand for future.
  • Azure App Service requires much less managerial efforts in comparison to Azure Virtual Machines.
  • The development of app is much simpler and faster in Azure App Service.
  • Azure VMs offer developer more control over the environment. Like, one can’t choose underlying OS of VM in an Azure App Service.
  • Azure App Services do not offer Pay-as-you-Go. Hence, you’re paying for the service plan, even if you’re not using it.
  • There may be constraints for the support of certain programming languages on Azure App Service. In that case, one has to use Azure VM to create environment for the programming language.

Consider each of the above points, match them according to your need, and then decide, which service suits best for your use-case.

--

--

--

Microsoft Student Partner | Samsung Brand Ambassador | Bachelors in Computer Science Student | Aviation geek | Formula One Fan

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Layman’s Web Development Bible

SwiftUI — Building List and Navigation

Caching: Using Hazelcast with Eureka

Announcing the Partnership with EQ8 Network

The Rollercoaster Ride of a (very) Junior Developer

A dive into SoftHSM

Adding LEDs to a Cross-Stitch Project

Building the new SalesLoft API

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Karan Singh

Karan Singh

Microsoft Student Partner | Samsung Brand Ambassador | Bachelors in Computer Science Student | Aviation geek | Formula One Fan

More from Medium

Improve performance & scalability of Azure Cosmos DB SQL API

How to Azure — Intro to Azure-3

Azure Cloud: What is Azure Function App? How to use it as tester?

Removing orphan records from Azure App Configuration Service when importing the data